queue map manager: not using std::atomic anymore
This commit is contained in:
parent
b61e1df8bc
commit
78283ddbee
@ -17,6 +17,10 @@ QueueMapManager* QueueMapManager::instance() {
|
||||
|
||||
ReturnValue_t QueueMapManager::addMessageQueue(
|
||||
MessageQueueIF* queueToInsert, MessageQueueId_t* id) {
|
||||
// Not thread-safe, but it is assumed all message queues are created
|
||||
// at software initialization now. If this is to be made thread-safe in
|
||||
// the future, it propably would be sufficient to lock the increment
|
||||
// operation here
|
||||
uint32_t currentId = queueCounter++;
|
||||
auto returnPair = queueMap.emplace(currentId, queueToInsert);
|
||||
if(not returnPair.second) {
|
||||
@ -28,7 +32,6 @@ ReturnValue_t QueueMapManager::addMessageQueue(
|
||||
if (id != nullptr) {
|
||||
*id = currentId;
|
||||
}
|
||||
mapLock = MutexFactory::instance()->createMutex();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
private:
|
||||
//! External instantiation is forbidden.
|
||||
QueueMapManager();
|
||||
std::atomic<uint32_t> queueCounter = 1;
|
||||
uint32_t queueCounter = 1;
|
||||
MutexIF* mapLock;
|
||||
QueueMap queueMap;
|
||||
static QueueMapManager* mqManagerInstance;
|
||||
|
Loading…
Reference in New Issue
Block a user