[Python-Dev] Python threads end up blocking signals in subprocesses (original) (raw)

Martin v. Löwis martin at v.loewis.de
Sun Dec 21 05:27:45 EST 2003


Michael Hudson <mwh at python.net> writes:

> I'm not sure what to do about this: We apparently want the signals > blocked in the thread, but we don't want them to be blocked in the > process invoked through system(). Proposals are welcome.

Does pthreadatfork() help?

Most likely. system(3) is specified as being implemented through fork()/exec(), so an atfork handler should be invoked in any compliant implementation. We could install a child handler, which unblocks the signals we don't want to be blocked.

Now, the question is: What signals precisely we don't want to be blocked? I think the answer is "All signals that have not explicitly been blocked by the application".

OTOH, we already have PyOS_AfterFork, which could be used instead of pthread_atfork. Jeff, would you like to add some code there, to set all signal handlers into default for which Handlers lists that the default handling should occur?

Regards, Martin



More information about the Python-Dev mailing list