Merge pull request 'QueueMapManager bugfix' (#444) from mueller/queuemapmanager-bugfix into development
Reviewed-on: fsfw/fsfw#444
This commit is contained in:
commit
ac146339a2
@ -17,7 +17,13 @@ QueueMapManager* QueueMapManager::instance() {
|
||||
|
||||
ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) {
|
||||
MutexGuard lock(mapLock);
|
||||
uint32_t currentId = queueCounter++;
|
||||
uint32_t currentId = queueCounter;
|
||||
queueCounter++;
|
||||
if(currentId == MessageQueueIF::NO_QUEUE) {
|
||||
// Skip the NO_QUEUE value
|
||||
currentId = queueCounter;
|
||||
queueCounter++;
|
||||
}
|
||||
auto returnPair = queueMap.emplace(currentId, queue);
|
||||
if(not returnPair.second) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
QueueMapManager();
|
||||
~QueueMapManager();
|
||||
|
||||
uint32_t queueCounter = 0;
|
||||
uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1;
|
||||
MutexIF* mapLock;
|
||||
QueueMap queueMap;
|
||||
static QueueMapManager* mqManagerInstance;
|
||||
|
@ -24,7 +24,13 @@ QueueMapManager* QueueMapManager::instance() {
|
||||
ReturnValue_t QueueMapManager::addMessageQueue(
|
||||
MessageQueueIF* queueToInsert, MessageQueueId_t* id) {
|
||||
MutexGuard lock(mapLock);
|
||||
uint32_t currentId = queueCounter++;
|
||||
uint32_t currentId = queueCounter;
|
||||
queueCounter++;
|
||||
if(currentId == MessageQueueIF::NO_QUEUE) {
|
||||
// Skip the NO_QUEUE value
|
||||
currentId = queueCounter;
|
||||
queueCounter++;
|
||||
}
|
||||
auto returnPair = queueMap.emplace(currentId, queueToInsert);
|
||||
if(not returnPair.second) {
|
||||
/* This should never happen for the atomic variable. */
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
QueueMapManager();
|
||||
~QueueMapManager();
|
||||
|
||||
uint32_t queueCounter = 0;
|
||||
uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1;
|
||||
MutexIF* mapLock;
|
||||
QueueMap queueMap;
|
||||
static QueueMapManager* mqManagerInstance;
|
||||
|
Loading…
Reference in New Issue
Block a user