WIP: somethings wrong.. #19
@ -17,6 +17,10 @@ QueueMapManager* QueueMapManager::instance() {
|
|||||||
|
|
||||||
ReturnValue_t QueueMapManager::addMessageQueue(
|
ReturnValue_t QueueMapManager::addMessageQueue(
|
||||||
MessageQueueIF* queueToInsert, MessageQueueId_t* id) {
|
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++;
|
uint32_t currentId = queueCounter++;
|
||||||
auto returnPair = queueMap.emplace(currentId, queueToInsert);
|
auto returnPair = queueMap.emplace(currentId, queueToInsert);
|
||||||
if(not returnPair.second) {
|
if(not returnPair.second) {
|
||||||
@ -28,7 +32,6 @@ ReturnValue_t QueueMapManager::addMessageQueue(
|
|||||||
if (id != nullptr) {
|
if (id != nullptr) {
|
||||||
*id = currentId;
|
*id = currentId;
|
||||||
}
|
}
|
||||||
mapLock = MutexFactory::instance()->createMutex();
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
//! External instantiation is forbidden.
|
//! External instantiation is forbidden.
|
||||||
QueueMapManager();
|
QueueMapManager();
|
||||||
std::atomic<uint32_t> queueCounter = 1;
|
uint32_t queueCounter = 1;
|
||||||
MutexIF* mapLock;
|
MutexIF* mapLock;
|
||||||
QueueMap queueMap;
|
QueueMap queueMap;
|
||||||
static QueueMapManager* mqManagerInstance;
|
static QueueMapManager* mqManagerInstance;
|
||||||
|
Loading…
Reference in New Issue
Block a user