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. A later thread may very well beat an early thread. But it is worth noting that whatever threading model you are using in your C++ COM object is of no relevance to the capacity of the VB6 application to use the said COM object. By design, cross-apartment marshaling will occur from your C++ COM object to the VB6 sink without you having to code a single line for this. VB6's inability to multi-thread is of no concern to your particular case. Again, nobugz is correct in stating that you need to synchronize the events yourself. It seems that getting the events fired in the incorrect order messes things up. Therefore, it is safe to assume that a set of events can be grouped together under a defined criterion or criteria that you already know (because then you wouldn't be complaining about this). So, my suggestion is that you create one event-firing thread for each set of events, rather than one event-firing thread per single event. This way, related events get serialized into the same event-firing thread, therefore ensuring the proper firing order. Note that you will also have to set in place some sort of "event set ID" to be able to identify a particular set of events from another set of events that might be being fired by another event-firing thread. If you manage to do this, you'll be in the good side of things once more. BTW, this became a problem because... ?? Did you move from a single-core machine to a multi-core machine? Just curious. :-) MCP- Proposed As Answer bywebJose Wednesday, September 23, 2009 4:51 AM
-
|