2020-12-14 11:17:22 +01:00
|
|
|
#include "Mutex.h"
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../../ipc/MutexFactory.h"
|
2018-07-13 15:56:37 +02:00
|
|
|
|
|
|
|
|
2020-12-14 11:17:22 +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
|
2018-07-13 15:56:37 +02:00
|
|
|
//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
|
|
|
|
|
|
|
MutexFactory::MutexFactory() {
|
|
|
|
}
|
|
|
|
|
|
|
|
MutexFactory::~MutexFactory() {
|
|
|
|
}
|
|
|
|
|
|
|
|
MutexFactory* MutexFactory::instance() {
|
2020-12-14 11:17:22 +01:00
|
|
|
if (factoryInstance == nullptr){
|
2018-07-13 15:56:37 +02:00
|
|
|
factoryInstance = new MutexFactory();
|
|
|
|
}
|
|
|
|
return MutexFactory::factoryInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
MutexIF* MutexFactory::createMutex() {
|
|
|
|
return new Mutex();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MutexFactory::deleteMutex(MutexIF* mutex) {
|
|
|
|
delete mutex;
|
|
|
|
}
|