Ok, after some reading I can see that the solution using volatile is not as good as I thought it would be. 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. I will try to come up with a solution using std::atomic or std::condition_variable which should be much cleaner.
On 10 October 2013 20:48, Greg Clayton <[email protected]> wrote: > I didn't catch the spin lock. We should either use std::atomic or there as > std::condition_variable if condition variables are needed. > > > > > On Oct 10, 2013, at 11:45 AM, Richard Mitton <[email protected]> > wrote: > > > > > Why does this replace a condition variable with a 10 millisecond > > spinlock? Spinlocks are bad. > > > > I don't know about the C++11 standard, but if you want the same effect > > on Windows you'd just use SetEvent. > > > > Also don't use volatile. In fact, never use volatile. m_output_flushed > > is a class variable, so the compiler knows to reload it each time > anyway. > > > > Richard Mitton > > [email protected] > > > > http://llvm-reviews.chandlerc.com/D1785 > > _______________________________________________ > > lldb-commits mailing list > > [email protected] > > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > >
_______________________________________________ lldb-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
