title: Cross-Platform equivalent to windows events
body: <p>I'm trying to port some Windows code to Linux, ideally through platform-independent libraries (eg boost), however I'm not sure how to port this bit of event code.</p>
  
  <p>The bit of code involves two threads (lets call them A and B). A wants to do something that only B can, so it sends B a message, then waits for B to say its done. In windows this looks something like:</p>
  
  <pre><code>void foo();//thread a calls this
  void bar(HANDLE evt);
  
  void foo()
  {
      HANDLE evt = CreateEvent(0,FALSE,FALSE,0);
      bCall(boost::bind(&amp;bar, evt));
      WaitForSingleObject(evt,INFINITE);
      CloseHandle(evt);
  }
  void bar(HANDLE evt)
  {
      doSomething();
      SetEvent(evt);
  }
  </code></pre>
  
  <p>I looked at the boost::thread library, but it didnt seem to have anything that does this, the closes I could see was the boost::condition_variable, but it appears that is means in conjunction with a mutex, which is not the case here.</p>