Multithreaded COM server problem...

Mark Hammond mhammond at skippinet.com.au
Sat Jan 10 17:31:28 EST 2004


John Lull wrote:

> I'm writing a multithreaded COM server to manage a pool of hardware resources.
> All objects are designed to be thread-safe, and I've set sys.coinit_flags to
> COINIT_MULTITHREADED before importing pythoncom.

Note that this flag is effeectively ignored for the server.  Objects are 
created in the same "apartment" as their creator.  This, the code 
implementing your object need not specify this, but the code *creating* 
the object must.  This is what determines the appartment.

COM threading rules are complex, but "Python Programming on Win32" (1/2 
by me :) covers these rules in words I would have trouble finding again :)

Mark.




More information about the Python-list mailing list