I am now trying a process and threads hybrid to get around the problem.

We can hope that for Perl 6 a function can be added to threads for immediate termination of child threads and freeing resources immediately from the parent thread.

Alun

$Bill Luebkert wrote:

ajpeck wrote:

Is there a way to forcibly terminate a thread after a specified time regardless if the thread is finished executing. I have threads which call certain network functions that have very long hard coded timeouts, such as 5 mins. A no response of 5 secs is sufficient for me to know that there is a problem and the nature of it is not needed (device switched off, network break, etc). These threads only write out a status result (threads::shared variable) at the very end of the thread execution, thus terminating the thread early from within the parent thread and with no result written is good enough for me to know that there is a problem.

Is there a way to impliment timed thread termination, if so I would appreciate it very much for a very simple example.

I tried (using Win32::API) to get the current thread ID and store
in a shared vrbl by the sub thread and terminate the sub thread
from the root thread, but I get an error on the TerminateThread :

        Bad file descriptor (The handle is invalid)

even though the thread ID looks fine.

So unless that can be resolved, that won't work.


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to