<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><div>Ok, after some reading I can see that the solution using volatile is not as good as I thought it would be.<br></div>As for the 10ms delay, I thought that would just be good practice to hand the CPU back to the OS and other threads instead of wasting cycles in an empty loop.<br>

</div>I will try to come up with a solution using std::atomic or std::condition_variable which should be much cleaner.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On 10 October 2013 20:48, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I didn't catch the spin lock. We should either use std::atomic or there as std::condition_variable if condition variables are needed.<br>


<br>
<br>
<br>
<br>
On Oct 10, 2013, at 11:45 AM, Richard Mitton <<a href="mailto:richard@codersnotes.com" target="_blank">richard@codersnotes.com</a>> wrote:<br>
<br>
><br>
</div><div><div>>  Why does this replace a condition variable with a 10 millisecond<br>
>  spinlock? Spinlocks are bad.<br>
><br>
>  I don't know about the C++11 standard, but if you want the same effect<br>
>  on Windows you'd just use SetEvent.<br>
><br>
>  Also don't use volatile. In fact, never use volatile. m_output_flushed<br>
>  is a class variable, so the compiler knows to reload it each time anyway.<br>
><br>
>  Richard Mitton<br>
>  <a href="mailto:richard@codersnotes.com" target="_blank">richard@codersnotes.com</a><br>
><br>
> <a href="http://llvm-reviews.chandlerc.com/D1785" target="_blank">http://llvm-reviews.chandlerc.com/D1785</a><br>
</div></div><div><div>> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></div><br></div>