Threads on Win32 with Blocking calls
Aahz Maruch
aahz at panix.com
Sun Apr 22 11:57:18 EDT 2001
In article <Pine.LNX.4.31.0104222001420.1071-100000 at cb921.local>,
Campbell <cb921 at voice.co.za> wrote:
>
>I've read in the thread documentation that not all blocking io functions
>work well under threads. The C libs I am interfacing to are
>threadworthy, but I need a bunch of threads that all block without
>blocking each other. Everything seems to point to this being the
>problem.. does anyone have tips or help, workaround or solution?
The classic example is socket.gethostbyname() which on many platforms
does not have a threadsafe, reentrant version. If you're talking about
a library that you're interfacing to, and you want to release the global
interpreter lock to remove blocking, you'll need to write a Python
extension layer that uses the macros Py_BEGIN_ALLOW_THREADS and
Py_END_ALLOW_THREADS to wrap your library.
--
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"Beware of companies that claim to be like a family. They might not be
lying." --Jill Lundquist
More information about the Python-list
mailing list