faqts : Computers : Programming : Languages : Python : Common Problems : Threads

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 7 people (100%) answered Yes
Recently 4 of 4 people (100%) answered Yes

Entry

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

Jul 23rd, 2000 06:05
unknown unknown, Richard Brodie


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.
------------
This is only a solution if the problem occurs when using a non-standard 
extension module (ie, a Python module implemented in C/C++).  The 
statement "you need to release and reaquire the lock" is misleading - 
you can _not_ do this from Python code - only C code can do this.