I'm trying to create a new thread by calling the StartThread after it prints to 10.use threads; use threads::shared; use Thread::Queue; # Signal Handler $SIG{'KILL'} = sub { # Tell user we've been terminated printf(" %3d <- Killed\n", threads->tid()); # Detach and terminate threads->detach() if ! threads->is_detached(); threads->exit(); }; StartThread(); sub StartThread { my @threads = threads->list(); # Check to see if there any running threads foreach ( @threads ) { print "Killing thread ... "; $_->kill('KILL'); print "Done\n"; } # Spawn new thread my $worker = threads->create(\&StartTest ); } sub StartTest { for ( 0..10 ) { print "I: $_\n"; } StartThread(); }
In reply to continue after killing thread? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |