Python2.1->2.2 broke my thread/signal code?

Michael Hudson mwh at python.net
Tue Nov 5 09:15:38 EST 2002


Hugo van der Merwe <s13361562 at spammenot.bach.sun.ac.za> writes:

> I have some code starting ogg123 in a new thread, I then send signals 
> (SIGTERM. Clearly the code is "wrong", since it didn't survive the 2.1->2.2 
> upgrade. What should I change? What am I doing wrong?

You're using threads, signals *and* fork?  This is a recipe for
confusion!

The problem is that it's not the main thread calling fork().  Non-main
threads get a sigmask that blocks out just about everything and when
you exec() ogg123, the child inherits the sigmask.  I think.

Getting the main thread to do the exec()s is probably easiest (have it
wait on a Queue.Queue, exec() what it pops off and push the pid back
onto another queue?).

I wrote a sigprocmask interface for Python 2.3, but it's currently
disabled because it's x-platform behaviour was inscrutable.  (I'm
guessing from the fact that your code ever worked, you're on linux?).

Cheers,
M.

-- 
  It could be argued that since Suitespot is infinitely terrible,
  that anything else, by very definition of being anything else,
  is infinitely superior.                -- ".", alt.sysadmin.recovery



More information about the Python-list mailing list