This commit is contained in:
Robin Müller 2021-07-19 14:40:32 +02:00
parent df1d5e5005
commit 0b45e5c89a
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,10 @@ ReturnValue_t QueueMapManager::addMessageQueue(
MessageQueueIF* queueToInsert, MessageQueueId_t* id) { MessageQueueIF* queueToInsert, MessageQueueId_t* id) {
MutexGuard lock(mapLock); MutexGuard lock(mapLock);
uint32_t currentId = queueCounter++; uint32_t currentId = queueCounter++;
if(currentId == MessageQueueIF::NO_QUEUE) {
// Skip the NO_QUEUE value
currentId = queueCounter++;
}
auto returnPair = queueMap.emplace(currentId, queueToInsert); auto returnPair = queueMap.emplace(currentId, queueToInsert);
if(not returnPair.second) { if(not returnPair.second) {
/* This should never happen for the atomic variable. */ /* This should never happen for the atomic variable. */

View File

@ -41,7 +41,8 @@ private:
QueueMapManager(); QueueMapManager();
~QueueMapManager(); ~QueueMapManager();
uint32_t queueCounter = 0; // Start at 1 because 0 might be the NO_QUEUE value
uint32_t queueCounter = 1;
MutexIF* mapLock; MutexIF* mapLock;
QueueMap queueMap; QueueMap queueMap;
static QueueMapManager* mqManagerInstance; static QueueMapManager* mqManagerInstance;