I have two threads that communicate in the following way: Thread A posts a message in a message queue and Thread B processes that message. Thread A has to wait until Thread B processes the message.
Thread A
.........
post a message on the message queue
WaitForSingleObject (hEvent)
Use the message processed information
SetEvent(hEvent)
.........Thread B
Process the message in the message queue
SetEvent(hEvent)
Do you see any problems with the above code? Do I need to call ResetEvent() anywhere? Is the SetEvent() call required in Thread A or Thread A should only call WaitForSingleObject() and Thread B should only call SetEvent()?
Thanks in advance