SetEvent (WIN-API synchronization)

The problem is that I am trying to use WIN-API style synchronization between a few threads. The multithreading model is COM-based (i.e. using CoInitialize, CoGetInterfaceAndReleaseStream, etc). I have a public array of events (long) and some threads Wait(ing)ForMultipleObjects on it. When I try to SetEvent on one of the array elements I get all the elements in the array signaled and the wait function returns of course WAIT_OBJECT_0. Please dont ask me to rewrite entire project in C or to use standard VB. Is there anybody who knows whats wrong with this SetEvent function?

Thanks.


(VB5, NT4.0-SP4)


Comments

  • The problem is not in the SetEvent function, but in the Array of handles. I am NOT a VB programmer, but I am a NT system's programmer and use this function often. It will not signal more than one event (assuming that you passed it one handle). Send the code and I will look at it quickly.




  • I know it will always signal only one object. It actually makes a FOR through the array and will return the FIRST INDEX FOUND SIGNALED. My problem is that it is always the FIRST ELEMENT IN THE ARRAY (WAIT_OBJECT_0), no matter which event I am actually signaling. In VB there is no distinct HANDLE data-type. For that one we use LONG (basically the same thing) signed.




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories