Unverified Commit 09c2026b authored by Bence Frenyó's avatar Bence Frenyó Committed by GitHub
Browse files

Merge pull request #70 from NordicSemiconductor/fix/event-queue-lock

Fixed serialization transport to access queue in a safe manner
parents 3fcdc514 742153a7
......@@ -162,10 +162,14 @@ void SerializationTransport::eventHandlingRunner()
{
while (runEventThread) {
std::unique_lock<std::mutex> eventLock(eventMutex);
eventWaitCondition.wait(eventLock);
while (!eventQueue.empty())
{
eventData_t eventData = eventQueue.front();
eventQueue.pop();
eventLock.unlock();
// Allocate memory to store decoded event including an unknown quantity of padding
// Set security context
......@@ -188,21 +192,9 @@ void SerializationTransport::eventHandlingRunner()
}
free(eventData.data);
}
std::unique_lock<std::mutex> eventLock(eventMutex);
if (!runEventThread)
{
break;
}
if (!eventQueue.empty())
{
continue;
eventLock.lock();
}
eventWaitCondition.wait(eventLock);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment