instead of using a while loop, just block based on whether or not another thread is holding the queue mutex;

pull/85/head
Bryan Biedenkapp 10 months ago
parent 774558ebd7
commit e6188b21aa

@ -12,7 +12,6 @@
#include "network/udp/Socket.h"
#include "Log.h"
#include "Utils.h"
#include "Thread.h"
using namespace network;
@ -119,8 +118,7 @@ void RawFrameQueue::enqueueMessage(const uint8_t* message, uint32_t length, sock
// if the queue is flushing -- don't attempt to enqueue any messages
if (m_queueFlushing) {
LogWarning(LOG_NET, "RawFrameQueue::enqueueMessage() -- queue is flushing, waiting to enqueue message");
while (m_queueFlushing)
Thread::sleep(1U);
std::lock_guard<std::mutex> lock(m_queueMutex);
}
uint8_t* buffer = new uint8_t[length];

Loading…
Cancel
Save

Powered by TurnKey Linux.