Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: about THREAD SIGNALLING

by anaconda_wly (Scribe)
on Apr 23, 2013 at 07:15 UTC ( #1030054=note: print w/ replies, xml ) Need Help??


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; }


Comment on Re^3: about THREAD SIGNALLING
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030054]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-07-13 00:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (244 votes), past polls