I have embedded the Python interpreter into a COM application. In this
application, I create worker threads that execute Python code.

I marshal some COM objects that live in the UI thread of the application over to
the worker thread and wrap them with EnsureDispatch() for use in the new thread.

Meanwhile, the UI thread sometimes has work to do with Python. It attempts to
acquire the GIL and releases it when done. However, while it is waiting for the
GIL in the UI thread (when the worker thread has it), it is locked into a
WaitForSingleObject call (some layers below PyGILState_Ensure).

Anyone that uses COM knows that this is not a COM-safe wait, and message pumping
will not continue. In other words, if my worker thread ever wants to marshal a
call back into the UI thread, it will deadlock. I need some way to use a
COM-safe wait for the GIL, such as CoWaitForMultipleHandles.

Has anyone run into this problem or have a solution?

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to