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) {
|
ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) {
|
||||||
MutexGuard lock(mapLock);
|
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);
|
auto returnPair = queueMap.emplace(currentId, queue);
|
||||||
if(not returnPair.second) {
|
if(not returnPair.second) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
@ -39,7 +39,7 @@ private:
|
|||||||
QueueMapManager();
|
QueueMapManager();
|
||||||
~QueueMapManager();
|
~QueueMapManager();
|
||||||
|
|
||||||
uint32_t queueCounter = 0;
|
uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1;
|
||||||
MutexIF* mapLock;
|
MutexIF* mapLock;
|
||||||
QueueMap queueMap;
|
QueueMap queueMap;
|
||||||
static QueueMapManager* mqManagerInstance;
|
static QueueMapManager* mqManagerInstance;
|
||||||
|
@ -24,7 +24,13 @@ QueueMapManager* QueueMapManager::instance() {
|
|||||||
ReturnValue_t QueueMapManager::addMessageQueue(
|
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;
|
||||||
|
queueCounter++;
|
||||||
|
if(currentId == MessageQueueIF::NO_QUEUE) {
|
||||||
|
// Skip the NO_QUEUE value
|
||||||
|
currentId = queueCounter;
|
||||||
|
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. */
|
||||||
|
@ -41,7 +41,7 @@ private:
|
|||||||
QueueMapManager();
|
QueueMapManager();
|
||||||
~QueueMapManager();
|
~QueueMapManager();
|
||||||
|
|
||||||
uint32_t queueCounter = 0;
|
uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1;
|
||||||
MutexIF* mapLock;
|
MutexIF* mapLock;
|
||||||
QueueMap queueMap;
|
QueueMap queueMap;
|
||||||
static QueueMapManager* mqManagerInstance;
|
static QueueMapManager* mqManagerInstance;
|
||||||
|
Loading…
Reference in New Issue
Block a user