Bram Stolk wrote: > I've implemented, in C, a function that does a lot of I/O, and thus > can block for a long time. > > If I execute this function in my Python script, it does not > relinquish the global interpreter lock, like Python's native > blocking functions do, like I/O funcs, and time.sleep() func. > > How can I have my func release the lock?
Search the Python documentation (Python/C API section) for information about the Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS macros. Perusing Python's source would also be educational (eg Modules/posixmodule.c). -- ------------------------------------------------------------------------- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: [EMAIL PROTECTED] (pref) | Snail: PO Box 370 [EMAIL PROTECTED] (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia -- http://mail.python.org/mailman/listinfo/python-list