Synchronizing calls to COM event handlers in the free threaded appartment

Krzysztof Czarnowski Krzysztof.Czarnowski at dgt-lab.com.pl
Fri Nov 9 08:46:56 EST 2001


I have a COM event handler object implemented in Python and instantiated in
a threading.Thread which is CoInitializedEx as COINIT_MULTITHREADED.
There is a threading.Lock object which is acquired by each event handler
method as soon the handler method is started and released just befor it
returns. The Lock is meant to provide synchronization among event handlers
and synchronization with another threading.Thread.
It looks fine at first but when I think second time...

Is it OK?

Is threading.Lock sufficient means to ensure serialization of event handler
calls?

Can it lead to deadlocks?

Is RLock sufficient then?

Or is it better to make it COINIT_APPARTMENTTHREADED and make COM do the
synchronization job?


Thanks in advance for any comments
Krzysztof







More information about the Python-list mailing list