fsfw/src/fsfw/osal/freertos/MutexFactory.cpp

24 lines
692 B
C++
Raw Normal View History

2021-07-14 00:54:39 +02:00
#include "fsfw/ipc/MutexFactory.h"
2018-07-13 15:56:37 +02:00
2022-02-02 10:29:30 +01:00
#include "fsfw/osal/freertos/Mutex.h"
2018-07-13 15:56:37 +02:00
2022-02-02 10:29:30 +01:00
// TODO: Different variant than the lazy loading in QueueFactory.
// What's better and why? -> one is on heap the other on bss/data
// MutexFactory* MutexFactory::factoryInstance = new MutexFactory();
2020-12-14 11:17:22 +01:00
MutexFactory* MutexFactory::factoryInstance = nullptr;
2018-07-13 15:56:37 +02:00
2022-02-02 10:29:30 +01:00
MutexFactory::MutexFactory() {}
2018-07-13 15:56:37 +02:00
2022-02-02 10:29:30 +01:00
MutexFactory::~MutexFactory() {}
2018-07-13 15:56:37 +02:00
MutexFactory* MutexFactory::instance() {
2022-02-02 10:29:30 +01:00
if (factoryInstance == nullptr) {
factoryInstance = new MutexFactory();
}
return MutexFactory::factoryInstance;
2018-07-13 15:56:37 +02:00
}
2022-02-02 10:29:30 +01:00
MutexIF* MutexFactory::createMutex() { return new Mutex(); }
2018-07-13 15:56:37 +02:00
2022-02-02 10:29:30 +01:00
void MutexFactory::deleteMutex(MutexIF* mutex) { delete mutex; }