Dan Dimerman wrote:
"Ben Hutchings"
wrote in message news:41B47000.1030500@businesswebsoftware.com... That still won't solve your problem, in general. Multithreading is an / ... / 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.
In this case, I think the problem was that by {mis,ab,}using the boost thread lib, I passed a copy of the functor that would be the worker thread instead of just a reference to it, hence the duplicity. Protecting that variable with a mutex wouldn't have had any effect, since there would have been two copies still.
I realise that, but I think eliminating the copy only solves half the problem. Ben.