So much code. Try this:
#! perl -slw use strict; use Time::HiRes qw[ sleep ]; use threads; use threads::shared; my $sig :shared = 0; $SIG{ USR1 } = $SIG{ INT } = $SIG{ ALRM } = sub { $sig = 1; }; async { while( 1 ) { sleep 0.1 until $sig; print 'Did some work'; $sig = 0; } }->detach; alarm 10; 1 while sleep 1; __END__ C:\test>908605.pl No such signal: SIGUSR1 at C:\test\908605.pl line 11. Did some work Did some work Did some work Terminating on signal SIGBREAK(21)
In reply to Re: perl threads crashed
by BrowserUk
in thread perl threads crashed
by liunx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |