From: Nicholas Clark Date: Fri, 12 May 2006 11:47:40 +0000 (+0000) Subject: Threads and signals. Delicious. Tweak change 28168 to add a local X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=774c1dbe9c1c746052dd9e19943a877c2976de96;p=p5sagit%2Fp5-mst-13.2.git Threads and signals. Delicious. Tweak change 28168 to add a local signal handler in the sleeping thread, because some operating systems deliver the SIGINT to that thread rather than the signalling thread. p4raw-id: //depot/perl@28174 --- diff --git a/ext/threads/t/kill.t b/ext/threads/t/kill.t index 6f632bd..0e931f1 100644 --- a/ext/threads/t/kill.t +++ b/ext/threads/t/kill.t @@ -90,7 +90,10 @@ sub thr_func { # Thread sleeps until signalled ok(1, 'Thread sleeping'); - sleep(5); + { + local $SIG{'INT'} = sub {}; + sleep(5); + } # Should not go past here ok(0, 'Thread terminated normally'); return ('ERROR'); @@ -109,6 +112,8 @@ threads->yield(); # Interrupt thread's sleep call { + # We can't be sure whether the signal itself will get delivered to this + # thread or the sleeping thread local $SIG{'INT'} = sub {}; ok(kill('INT', $$) || $^O eq 'MSWin32', q/Interrupt thread's sleep call/); }