Python signal delivery under BSD 4.4

Alex Martelli aleaxit at yahoo.com
Fri Aug 15 05:06:43 EDT 2003


Michael Hudson wrote:

> "Elf M. Sternberg" <elf at drizzle.com> writes:
> 
>>         Right now, I just want a way to make signal delivery work.
> 
> At some point, the threads implementation got changed so that new
> threads get their signal mask set to "block everything and it's cat"
> (there was a reason for this, but I'm not really sure what it was).
> As I see it, you have two options: 1) write a little C to unset the
> procmask after fork() but before execve() 2) only launch apps from the
> main thread.

Incidentally, these aren't far from the advice in "Pthreads Programming"
(by Nichols, Buttlar and Proulx Farrell -- O'Reilly) in Chapter 5, under
"Threads and Process Management".  The authors are dealing with C issues,
not Python by any means, but still they conclude that "forking from a
multithreaded program is no picnic" and suggest 1) fork before you've
created any threads, and 2) consider the surrogate parent model (fork a
child process at init time, IPC with the child -- which remains single
threaded -- to delegate forking and execing on our behalf).


Alex





More information about the Python-list mailing list