title: is "b &= f();" thread-safe if "f()" is thread safe?
body: <p>Given a boolean b and a thread safe function f() that returns a boolean, is next statement thread-safe:</p>
  
  <pre><code>b &amp;= f();
  </code></pre>
  
  <p>The idea is several threads execute in parallel this statement. If one of them have f returning false, b should be false. Otherwise b is true.</p>
  
  <p>I guess is not atomic and it could happen that one thread reads b, freeze, meanwhile second thread read b, runs f(), apply &amp;, then first thread wake up, runs f() and apply &amp; using old b. </p>
  
  <p>Is guaranteed that a given thread, first run f() and then reads b and then apply &amp;? </p>