Archived
This forum has been archived. Please start a new discussion on GitHub.
A call queue question.
in Help Center
Hi, There,
Here the code snippet from Mathews article in Issue 12.
My question is why to check the _destroy again after wait() return.
I know here is some kind of trick and I remember ICE guys once mentioned this somewhere, but I can not find the actual words on it right now.
Thanks in advance.
OrNot
Here the code snippet from Mathews article in Issue 12.
void
CallQueue::run()
{
while(true)
{
CallPtr req;
{
Lock sync(*this);
while(!_destroy && _req.empty())
{
wait();
}
if(_destroy)
{
break;
}
req = _req.front();
_req.pop_front();
}
req->execute();
}
}
My question is why to check the _destroy again after wait() return.
I know here is some kind of trick and I remember ICE guys once mentioned this somewhere, but I can not find the actual words on it right now.
Thanks in advance.
OrNot
0
Comments
-
Sorry, I have to answer my stupid question on my own.
The reason to check the _destroy again is to distinguish it from the _req.empty() since the "&&" is there.
My mind must be deadlocked just now.0