integrated queue map manager bugfixes

This commit is contained in:
Robin Müller 2021-07-14 10:39:02 +02:00
parent 376617f9f9
commit 3c4289335e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 7 additions and 2 deletions

View File

@ -39,7 +39,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;

View File

@ -17,7 +17,11 @@ QueueMapManager* QueueMapManager::instance() {
ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) {
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, queue);
if(not returnPair.second) {
#if FSFW_CPP_OSTREAM_ENABLED == 1