title: Waiting for an atomic_bool
body: <p>I have two threads and a flag that gets set by the second thread. I could use an <code>atomic_bool</code>, but I want to be able to wait* for the flag being set on the first thread. How can I do that?</p>
  
  <p>I can't use a <code>condition_variable</code> I guess, because if the second thread calls <code>notify_one</code> before the first thread starts waiting, the thread won't wake up. </p>
  
  <p>Also, checking if the flag has already been set should be reasonably fast. I guess this should be rather simple, but I'm just stuck, so I'm asking here. Thanks in advance.</p>
  
  <p>*Edit: Block of course, not busy-wait. Sorry if that wasn't clear.</p>