title: C++0x has no semaphores? How to synchronize threads?
body: <p>Is it true that C++0x will come without semaphores? There are already some questions on Stack Overflow regarding the use of semaphores. I use them (posix semaphores) all the time to let a thread wait for some event in another thread:</p>
  
  <pre><code>void thread0(...)
  {
    doSomething0();
  
    event1.wait();
  
    ...
  }
  
  void thread1(...)
  {
    doSomething1();
  
    event1.post();
  
    ...
  }
  </code></pre>
  
  <p>If I would do that with a mutex:</p>
  
  <pre><code>void thread0(...)
  {
    doSomething0();
  
    event1.lock(); event1.unlock();
  
    ...
  }
  
  void thread1(...)
  {
    event1.lock();
  
    doSomethingth1();
  
    event1.unlock();
  
    ...
  }
  </code></pre>
  
  <p>Problem: It's ugly and it's not guaranteed that thread1 locks the mutex first (Given that the same thread should lock and unlock a mutex, you also can't lock event1 before thread0 and thread1 started).</p>
  
  <p>So since boost doesn't have semaphores either, what is the simplest way to achieve the above?</p>