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
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to