in reply to Re^4: Exiting a script with an 'infinitely looping' thread
in thread Exiting a script with an 'infinitely looping' thread
Due to Perl "safe signals", sleep is an uninteruptable opcode. Try it this way:
#!/usr/bin/perl -w use threads; $SIG{"INT"}=\&sigInt; my $thread=threads->create('test')->detach(); my $n = 100; 1 while --$n and sleep 1; sub test { my $n = 100; 1 while --$n and sleep 1; } sub sigInt { exit; }
|
|---|