pthread updates a common variable
<p>In my problem, I create a pthread using pthread_create(), say myThread.</p>

<p>They both share a common variable "done" for the main thread to tell the myThread stops reading from the socket.</p>

<p>in my pthread, I have a loop:</p>

<pre><code>// done is a common variable
while (!done &amp;&amp; socket-&gt;read(&amp;buffer) == OK) {
    // do something....
}
</code></pre>

<p>Some times, I want to tell myThread to stop reading from socket, so I do:</p>

<pre><code>done = true;
  void *test;
    pthread_join(myThread, &amp;test);
</code></pre>

<p>Will this cause a race condition? i.e. will myThread not see my main thread update the value of 'done' before it blocks on the read call?</p>
