![]() ![]() ![]() Nobugz is correct in saying that there is no guarantee that your event-firing threads will be processed in the same order they were created. I've been reading up on COM apartment models and have so far not come across anything that would explain why events are being received out of sequence. but this takes forever and is too great a performace hit. I have modified the COM class to fire all events in the same STA thread, holding up the main message loop until the STA thread completes. and yet, events arrive at the VB app out of sequence. Each event thread is running before the subsequent messages are picked up (and therefore subsequent event firing threads are created). Event firing threads are created close in time, but at different times. ![]() The issue occurs when messages arrive close in time and consequently the creation of event threads occurring close in time. When subsequent messages arrive, events are fired similarly (creation of a new event thread). ![]() On receiving a message, the COM object fires an event by creating a new thread, marshalling the sink interface pointer to the new thread and continues (leaving the event thread to complete the firing process) to pickup and process subsequent messages. The COM object receives and processes messages serially. We now see events being received by the VB app out of sequence from the order in which the COM object fired the events. The VB app creates and uses the COM object quite happliy and has worked well for years. I have a VB6 application and a VC++ COM class. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |