diff --git a/emper/UnboundedBlockingMpscQueue.hpp b/emper/UnboundedBlockingMpscQueue.hpp index 81c8a2ff4bcdf68462f2205ab8a8c5fe1f1d0d75..b9de4631dbd7831320da01bb1c1384bc215b79df 100644 --- a/emper/UnboundedBlockingMpscQueue.hpp +++ b/emper/UnboundedBlockingMpscQueue.hpp @@ -83,10 +83,16 @@ class UnboundedBlockingMpscQueue : public Blockable<LogSubsystem::U_B_MPSC_Q> { }); if (!tPopped) { std::lock_guard<std::mutex> lock(queueMutex); + // If we observed tPopped to be false without holding the + // queueMutex, then the same must be true when holding the + // mutex. + assert(!tPopped); + // If 't' isn't already set, then mspcQueue.get() MUST // return an element. Note that a non-lineralizabe // queue may break this invariant. assert(!mpscQueue.empty()); + t = mpscQueue.front(); mpscQueue.pop(); postRetrieve();