in reply to Re^2: about THREAD SIGNALLING
in thread about THREAD SIGNALLING

What's more, can catch_CtrlC gets parameters? Why below little change, adding a print in catch_CtrlC doesn't print anything(see line print "counter: $counter \n"; )?
#/usr/bin/perl use strict; use warnings; use threads; use threads::shared; my @thrList; my $count = 1; share $count; my $counter = 3; while($counter) { $counter--; my $thrHandle = threads->create(\&thrdfun); push @thrList, $thrHandle; } foreach(@thrList){ $_->join(); } sub thrdfun { sub catch_CtrlC { print "counter: $counter \n"; $SIG{'INT'} = threads->kill('TERM'); } $SIG{INT} = \&catchCtrlC; print "thrdfun: $count \n"; $count++; while(1){ (); } exit; }