Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: about THREAD SIGNALLING

by Khen1950fx (Canon)
on Apr 23, 2013 at 08:26 UTC ( #1030069=note: print w/replies, xml ) Need Help??


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

Just remember that sub catch_CtrlC {} and SIG{'INT'} = \&catch_CtrlC; must both be included in each thread that you want to SIGINT out of.
#/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 { $_->kill('TERM'); } $SIG{'INT'} = \&catch_CtrlC; print "thrdfun: $count \n"; $count++; while (1) { (); } exit; }

Replies are listed 'Best First'.
Re^4: about THREAD SIGNALLING
by anaconda_wly (Scribe) on Apr 23, 2013 at 08:44 UTC
    OK, I got the point. The thread sig handler should be defined inside the thread body, different from the process signal handler.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030069]
help
Chatterbox?
[1nickt]: stevieb it turns out that Dell still has the Precision line of "mobile workstations", just not displayed on their main website. I found the Precision 7710 with 4k display/full-size keybd as req'd.
[1nickt]: List $2,788 (!), on sale for $1766, also a $200 coupon on the site thru 3/30 ... final price $1,566. Includes 3-yr on-site service.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2017-03-27 12:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.