I guess Perl's threading is not quite complete as of 5.8.x. But with forking it is possible to kill a child process?

----- Original Message ----- From: "$Bill Luebkert" <[EMAIL PROTECTED]>
To: "ajpeck" <[EMAIL PROTECTED]>
Cc: "Perl Win32 mail list" <perl-win32-users@listserv.ActiveState.com>
Sent: Thursday, August 25, 2005 6:23 PM
Subject: Re: [threads] Forced termination


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.

--
 ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
(_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to