better form

This commit is contained in:
Robin Müller 2021-07-19 14:57:10 +02:00
parent e93230d0ef
commit baf3d4da47
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 8 additions and 4 deletions

View File

@ -17,10 +17,12 @@ 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) { if(currentId == MessageQueueIF::NO_QUEUE) {
// Skip the NO_QUEUE value // Skip the NO_QUEUE value
currentId = queueCounter++; currentId = queueCounter;
queueCounter++;
} }
auto returnPair = queueMap.emplace(currentId, queue); auto returnPair = queueMap.emplace(currentId, queue);
if(not returnPair.second) { if(not returnPair.second) {

View File

@ -24,10 +24,12 @@ 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) { if(currentId == MessageQueueIF::NO_QUEUE) {
// Skip the NO_QUEUE value // Skip the NO_QUEUE value
currentId = queueCounter++; currentId = queueCounter;
queueCounter++;
} }
auto returnPair = queueMap.emplace(currentId, queueToInsert); auto returnPair = queueMap.emplace(currentId, queueToInsert);
if(not returnPair.second) { if(not returnPair.second) {