Threading and GIL

googler.1.webmaster at googler.1.webmaster at
Wed May 6 20:13:29 EDT 2009


I have a big problem I can't solve and I hope anyone of you can help
me. I use the Python C API and in C++ I have a class which represets a
thread object, similiar to the thread class of the known Python Thread
class but with some needed additions so thats the reason why I have to
built my own. Well, this is the problem.

There is a method called Thread::End() which I can call in Python. But
now the End() Function waits until the "Main" Function of my C++ class
is done, but in this method I want to ensure the Global Interpreter
Lock but this is already locked by the Thread which executes the End()
command. So both is waiting and stops. The thread which calls the End
() method is waiting for the finish of the Main() method of the Thread
Class and the Main-Method in the other thread waits for the thread of
the End() command that this is done - welcome Deadlock.

Any suggestions what I have to do? Thank you veeery much for you help,
otherwise I become really crazy here because this is the first time I
have such a problem.

Bye :)

More information about the Python-list mailing list