diff options
| author | Dan Engelbrecht <[email protected]> | 2022-04-28 14:37:36 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-06-13 12:07:23 +0200 |
| commit | 172f54166b9c8fd259814fcf4377210bd523c9ce (patch) | |
| tree | 84f5d4083c1206108a4f1147cf80759821776516 /zencore | |
| parent | TMP: run tests in release build (diff) | |
| download | zen-de/upstream-server-tests.tar.xz zen-de/upstream-server-tests.zip | |
cleanupde/upstream-server-tests
Diffstat (limited to 'zencore')
| -rw-r--r-- | zencore/include/zencore/blockingqueue.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/zencore/include/zencore/blockingqueue.h b/zencore/include/zencore/blockingqueue.h index f92df5a54..4e2687003 100644 --- a/zencore/include/zencore/blockingqueue.h +++ b/zencore/include/zencore/blockingqueue.h @@ -36,18 +36,20 @@ public: } std::unique_lock Lock(m_Lock); - m_NewItemSignal.wait(Lock, [this]() { return !m_Queue.empty() || m_CompleteAdding.load(); }); - - if (!m_Queue.empty()) + if (m_Queue.empty()) { - Item = std::move(m_Queue.front()); - m_Queue.pop_front(); - m_Size--; - - return true; + m_NewItemSignal.wait(Lock, [this]() { return !m_Queue.empty() || m_CompleteAdding.load(); }); + } + if (m_Queue.empty()) + { + return false; } - return false; + Item = std::move(m_Queue.front()); + m_Queue.pop_front(); + m_Size--; + + return true; } void CompleteAdding() |