The Linux implementation of pthreads in the 2.0 through 2.4
(called LinuxThreads <http://pauillac.inria.fr/~xleroy/
linuxthreads/>) has one notable place where it diverges
from the pthreads standard. A signal caused by a thread will
only trigger the signal handler on that thread, and it is not
seen or able to be handled by any other thread. The
LinuxThreads package was first created in 1996 and is only
now starting to be replaced by the new Linux 2.6 threading
facility (called NPTL.)
The non-standard LinuxThreads behavior falls afoul with
Python's thread semantics, since it assumes that only the
main thread can set or act on signal handlers. For the
pthreads environment, it enforces this by blocking signals on
all threads except the main thread. On LinuxThreads, this
causes these signals to become ignored and lost, sometimes
causing deadlock.
The enclosed patch tests for LinuxThread's specific
peculiarities in the configure script and adjusts the handling
of thread creation and signal handling in order to give
threads the documented Python thread and signal behavior.
|