List Info

Thread: Re: Signals+Threads (PyGTK waking up 10x/sec).




Re: Signals+Threads (PyGTK waking up 10x/sec).
user name
2007-12-08 12:09:12
> """
> According to [1], all python needs to do to avoid this
problem is
> block all signals in all but the main thread; then we
can guarantee
> signal handlers are always called from the main thread,
and pygtk
> doesn't need a timeout.
> 
> [1] https://bugzilla.redhat.com/bugzilla/process_bug.cgi#c3
> """
> 
> Unfortunately I can't read [1] without having
registered, so I can
> only guess what it says. But I know that Python already
ensures that
> signals are only delivered to the main thread. What am
I missing?

Your notion of "delivers" differs. Python does
receive signals in
threads other than the main thread. However, it will only
invoke the
*Python* signal handler in the main thread.
signalmodule.c:signal_handler calls Py_AddPendingCall, which
is
only ever considered in the main thread (although perhaps
not
in a timely manner - this is precisely where the
busy-waiting in gtk
comes from).

Python does not attempt to block any signals, let alone
using
pthread_sigmask.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )