Python + Threads

Richard Brodie R.Brodie at rl.ac.uk
Thu Jul 20 06:16:38 EDT 2000


<rpevans at my-deja.com> wrote in message news:8l4kfb$sfr$1 at nnrp1.deja.com...

> Why is my pipe i/o thread blocking the other threads? Any answers?

There is a global lock within Python, protecting its internals. When you
call out from a Python to a C extension method in a thread, the thread
holds the lock.

For maximum parallelism, and particularly if you're doing blocking I/O
in a thread, you need to release and reaquire the lock.

See: http://www.python.org/doc/current/api/threads.html for details.

[Followups-to: comp.lang.python, as it's Python specific]





More information about the Python-list mailing list