Core/Threading: Fixed possible race condition with m_timeOutTime and fixed Thread #1: pthread_cond_{signal,broadcast}: dubious: associated lock is not held by any thread in PCQ

This commit is contained in:
Shauren
2014-08-12 18:18:52 +02:00
parent 9f7075215d
commit bd4edf6e22
2 changed files with 9 additions and 15 deletions

View File

@@ -39,10 +39,8 @@ public:
void Push(const T& value)
{
{
std::lock_guard<std::mutex> lock(_queueLock);
_queue.push(std::move(value));
}
std::lock_guard<std::mutex> lock(_queueLock);
_queue.push(std::move(value));
_condition.notify_one();
}
@@ -72,10 +70,7 @@ public:
{
std::unique_lock<std::mutex> lock(_queueLock);
while (_queue.empty() && !_shutdown)
{
_condition.wait(lock);
}
_condition.wait(lock, [this]() { return !_queue.empty() || _shutdown; });
if (_queue.empty() || _shutdown)
return;