about Python/C extensions and thread

kanji kanji_rama at yahoo.com
Fri Sep 17 10:44:04 CEST 2004


I know this question has been posed quite a number of times - but I
could did not find a suitable answer   to my problem. I have created 
a C library and its corresponding Python/C extension src file to
generate a python module.

My problem- is when i call the corresponding python functions (ie
which are actually calls of extension src file) in a multi-threaded
ptython program- i see either one of these two situations--
1. One thread runs to completion and the other hangs.
2. both the thread runs to completion.

This happens randomly.  

now in each of the C functions  of the Python/C extension src file - i
call a thread-safe C library function. This has been verified by a
separate threaded C client.

As per the docs, i have tried using Py_Begin_Allow_Threads /
PY_End_Allow_Threads macros in extension code  but it hasn't helped.

Any ideas or pointers will be greatly appreciated.

Little frustated,


kanji_rama at google.com

More information about the Python-list mailing list