title: One way communication between two threads through Events
body: <p>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.</p>
  
  <ol>
  <li><p>Thread A </p>
  
  <p>.........<br>
  post a message on the message queue<br>
  WaitForSingleObject (hEvent)<br>
  Use the message processed information<br>
  SetEvent(hEvent)<br>
  .........</p></li>
  <li><p>Thread B</p>
  
  <p>Process the message in the message queue<br>
  SetEvent(hEvent)  </p></li>
  </ol>
  
  <p>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()?</p>
  
  <p>Thanks in advance</p>