#! perl -slw use strict; use threads; sub sleeper { print "thread started; sleeping"; $SIG{'KILL'} = sub { print "Thread dieing"; threads->exit(); }; sleep( 1000 ); print "Thread dieing"; threads->detach; } my $t = threads->new( \&sleeper ); sleep 5; print "Killing thread"; $t->kill( 'KILL' )->detach; print "thread status: ", $t->error(); sleep 100 while 1;