[capi-sig] Threading

Pablo Yabo pablo.yabo at gmail.com
Mon Aug 13 23:51:27 CEST 2007


I want to embed Python in an application and use an API of the application
from Python.
The application uses a library that creates several threads and I the users
of the application will write Python scripts handling this events.

The problem is that I having problems with threads. I saw that I have to
PyEval_InitThreads and then PyThreadState_New and PyThreadState_Swap from
the new thread but this way to solve the problem doesn't work for me because
I need to let 2 or more threads run at the SAME time.
The interpreter lock doesn't let them run at the same time so I'm looking
for another solution. I saw Py_NewInterpreter and I tried to use it but it
doesn't work if I don't keep the lock.

Can anyone help me to solve this issue or tell me 'Forget it!'?

Thanks on advance,
Pablo Yabo

More information about the capi-sig mailing list