So, seemly valid code:
void wait_for_data() {
boost::mutex::scoped_lock lock(the_mutex);
if(the_queue.empty()) {
the_condition_variable.wait(lock); }
}
if(the_queue.empty()) {
the_condition_variable.wait(lock); }
}
need to be corrected:
void wait_for_data()
{
boost::mutex::scoped_lock lock(the_mutex);
while(the_queue.empty()) {
{
boost::mutex::scoped_lock lock(the_mutex);
while(the_queue.empty()) {
the_condition_variable.wait(lock); }}
links:
links:
0 comments:
Отправить комментарий