Multithreaded COM server problem...

Mark Hammond mhammond at skippinet.com.au
Mon Jan 19 17:46:08 EST 2004


John Lull wrote:
> Now I'm *really* confused.
> 
> Perhaps I need to clarify a bit. The sleep() method in my sample
> server is a perhaps-too-simplified substitute for what the real server
> is doing. It provides a variety of high-level operations on a piece of
> hardware. Some of the operations take as long as several dozen
> seconds, others take a millisecond or so. I need the client to block
> waiting for completion of each operation, regardless of how long the
> operation takes. I cannot break one of the long operations up into a
> series of calls from the client -- it must be implemented as a single
> call. My example would, perhaps, have been clearer if I'd named the
> method someLongRunningMethod() instead of sleep().

Is there any way you can do it asynchronously?  The main thread spawns a 
second thread to do the work.  The main thread then spins around a 
MsgWaitForMultipleObjects, with an object set by the second thread.  The 
main thread will then be able to run a message pump, but also detect 
when the second thread is done.

Apart from that, I am afraid I am out of ideas.  I believe however that 
you are hitting pure COM issues, and nothing related to Python.  Looking 
for the answer beyond the Python world may be fruitful.

Mark.




More information about the Python-list mailing list