title: Avoiding data race of boolean variables with pthreads
body: <p>in my code I have the following structure:</p>
  
  <p>Parent thread</p>
  
  <pre><code>somedatatype thread1_continue, thread2_continue; // Does bool guarantee no data race?
  </code></pre>
  
  <p>Thread 1:</p>
  
  <pre><code>while (thread1_continue) {
    // Do some work
  }
  </code></pre>
  
  <p>Thread 2:</p>
  
  <pre><code>while (thread2_continue) {
    // Do some work
  }
  </code></pre>
  
  <p>So I wonder which data type should be thread1_continue or thread2_continue to avoid data race. And also if there is any data type or technique in pthread to solve this problem.</p>