|
Boost Users : |
From: Sohail Somani (s.somani_at_[hidden])
Date: 2007-03-11 17:21:17
This is due to spurious wakeups (waking up from the condition when it hasn't actually been signalled). To be safe I think you have to always check the condition once you wake up from the condition => hence the while loops
-----Original Message-----
From: boost-users-bounces_at_[hidden] on behalf of Randall Parker
Sent: Sun 3/11/2007 10:44 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] [Threads] Conditions and avoiding lengthy mutexlocks (background loading for a game)
This is a reply to an April 2006 thread with two questions:
1) Why does the
myCond.wait( myMutex );
call happen inside a while loop rather than in an if statement? I would have
expected that since one is waiting for the queue to get something put in it that the
condition would only get set if something was placed in the queue. if one returned
from the wait and found the queue empty I'd tend to want to log that as an internal
error.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net