From 0b45e5c89a25e0f0222ae7c5a20d5839b80efff7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 14:40:32 +0200 Subject: [PATCH] fix --- osal/host/QueueMapManager.cpp | 4 ++++ osal/host/QueueMapManager.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/osal/host/QueueMapManager.cpp b/osal/host/QueueMapManager.cpp index 879bc36d..cea79f7b 100644 --- a/osal/host/QueueMapManager.cpp +++ b/osal/host/QueueMapManager.cpp @@ -25,6 +25,10 @@ ReturnValue_t QueueMapManager::addMessageQueue( MessageQueueIF* queueToInsert, MessageQueueId_t* id) { MutexGuard lock(mapLock); uint32_t currentId = queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + currentId = queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queueToInsert); if(not returnPair.second) { /* This should never happen for the atomic variable. */ diff --git a/osal/host/QueueMapManager.h b/osal/host/QueueMapManager.h index e274bed2..c4e0fcdf 100644 --- a/osal/host/QueueMapManager.h +++ b/osal/host/QueueMapManager.h @@ -41,7 +41,8 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + // Start at 1 because 0 might be the NO_QUEUE value + uint32_t queueCounter = 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance;