Dan Dimerman wrote:
Hello Cory, Thank you for your response. No, I'm ashamed to say, I didn't pass a boost::ref to the boost::thread. And you sir, have hit a bull's eye. <snip>
That still won't solve your problem, in general. Multithreading is an entirely non-standard extension to C++. Libraries like Boost.Thread go part way to providing portability, but memory semantics are troublesome. Actual implementations do not guarantee that changes to memory in one thread become visible in another thread in the same order, or at all. You should protect all access to the controlling flag with a mutex. In this case it would probably be sufficient to use the "volatile" qualifier on the controlling member, but this is not generally a good solution. Ben.