[python-win32] The GIL and COM

2009-01-21 Thread Brad Johnson
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. M

Re: [python-win32] The GIL and COM

2009-01-21 Thread Mark Hammond
On 22/01/2009 3:33 AM, Brad Johnson wrote: 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 E

Re: [python-win32] The GIL and COM

2009-01-21 Thread Brad Johnson
> > 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). > > Obviously the GIL can only be held by one thread at a time. The > question then is why your worker thread

Re: [python-win32] The GIL and COM

2009-01-21 Thread Mark Hammond
On 22/01/2009 9:38 AM, Brad Johnson wrote: 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). Obviously the GIL can only be held by one thread at a time. The question then