> I'm trying to integrate a Python event loop (specifically, > Twisted's reactor) into a COM in-process server. I've > discovered CoWaitForMultipleHandles and it seems like it > might be part of such a solution.
Sadly that is missing from the current pythoncom. However, WaitForMultipleObjects is, which does the same thing in a free-threaded apartment. > Also, I notice that > ICallFactory::CreateCall allows for calling a COM method and > not waiting for it to return, which it seems like I'd need > (since I want my other COM methods to be callable while my > event loop runs). However, it seems like i need to create a > new interface to do this, since CreateCall doesn't work with > IDispatch. Is it even possible to create a new COM interface > from python? Not easily. You may be able to use either ctypes, or abuse some other interface that has methods which are "close enough". The connection-point related ones might be suitable. > Is there a better way to do event loop integration with COM? I'm not completely clear on what you are trying to do. I assume that you want this event-loop to never block - one way to do this would be to use WaitForMultipleObjects, a queue and a thread-pool. I'm not sure how ICallFactory is implemented, so I'm not sure how efficient it is to create a huge number of pending calls - a queue etc would let you have more control over this process. Mark. _______________________________________________ Python-win32 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-win32
