Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Child thread not receiving SIGALRM
A thread+signal problem: the parent process sets the handler for SIGALRM and then starts a child thread. The child thread schedules and alarm call. This should make the child thread receive a SIGALRM signal, handled by the handler set by the parent process, right? Well... practice proved me wrong and I don't know why.
Actually, here is the code I've tested this whole thing with:
--- code ---
from signal import *
from thread import *
from time import *
print 'Alarm raised, exiting'
print 'Child started'
print 'Child: alarm set, will exit on signal'
print 'Child: tick'
print 'Parent started'
print 'Parent: spawned child, sleeping'
--- end code ---
This child should of course exit after 2 ticks but, surprisingly, it keeps going until the parent exits because the child never receives the SIGALRM signal.
Any ideas what is happening here, anyone?
0 · ·