Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: how to kill a thread in windows

by jdhedden (Deacon)
on Jun 23, 2006 at 20:58 UTC ( [id://557328]=note: print w/replies, xml ) Need Help??


in reply to how to kill a thread in windows

I recently added thead signalling capabilities to the threads module, and improved the functionality of calling exit inside a thread. These features can be used to provide kill/cancel threads as follows:
use threads; sub thr_func { # Thread 'cancellation' signal handler $SIG{'KILL'} = sub { threads->exit(); }; ... } # Create a thread my $thr = threads->create('thr_func'); ... # Signal the thread to terminate, and then detach # it so that it will get cleaned up automatically $thr->kill('KILL')->detach();
Be sure to get the latest version of the threads module from CPAN, and read the POD for more information and caveats.

Remember: There's always one more bug.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://557328]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-19 18:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found