Fix mingw32 compilation

This commit is contained in:
gabime 2019-09-17 13:27:42 +03:00
parent 35835469d7
commit e771f4e75e
1 changed files with 4 additions and 2 deletions

View File

@ -70,7 +70,7 @@ public:
// apparently mingw deadlocks if the mutex is released before cv.notify_one(),
// so release the mutex at the very end each function.
// try to enqueue and block if no room left
// try to enqueue and block if no room left
void enqueue(T &&item)
{
std::unique_lock<std::mutex> lock(queue_mutex_);
@ -85,6 +85,7 @@ public:
std::unique_lock<std::mutex> lock(queue_mutex_);
q_.push_back(std::move(item));
push_cv_.notify_one();
}
// try to dequeue item. if no item found. wait upto timeout and try again
@ -96,7 +97,8 @@ public:
{
return false;
}
q_.pop_front(popped_item);
popped_item = std::move(q_.front());
q_.pop_front();
pop_cv_.notify_one();
return true;
}