I have the following code:
MyClass::aMethod()
{
...
bool isStarted = false;
boost::thread(boost::bind(&MyClass::CheckTimeoutThread, this, isStarted));
...//some time later
isStarted = true;
...
}
MyClass::checkTimeoutThread(bool &isStarted)
{
...//some code here
while(anotherFlag)
{
...//do something
if(isStarted)//ALWAYS THE INITIAL VALUE OF FALSE
{
}
...
}
}
I was expected the isStarted variable can be used as a flag but I am wrong or I was doing something wrong.