implemented semaph factory
This commit is contained in:
33
osal/FreeRTOS/SemaphoreFactory.cpp
Normal file
33
osal/FreeRTOS/SemaphoreFactory.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <framework/osal/FreeRTOS/BinarySemaphore.h>
|
||||
#include <framework/osal/FreeRTOS/CountingSemaphore.h>
|
||||
#include <framework/tasks/SemaphoreFactory.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
||||
|
||||
SemaphoreFactory::SemaphoreFactory() {
|
||||
}
|
||||
|
||||
SemaphoreFactory::~SemaphoreFactory() {
|
||||
delete factoryInstance;
|
||||
}
|
||||
|
||||
SemaphoreFactory* SemaphoreFactory::instance() {
|
||||
if (factoryInstance == nullptr){
|
||||
factoryInstance = new SemaphoreFactory();
|
||||
}
|
||||
return SemaphoreFactory::factoryInstance;
|
||||
}
|
||||
|
||||
SemaphoreIF* SemaphoreFactory::createBinarySemaphore() {
|
||||
return new Semaphore();
|
||||
}
|
||||
|
||||
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t count,
|
||||
uint8_t initCount) {
|
||||
return new CountingSemaphore(count, initCount);
|
||||
}
|
||||
|
||||
void SemaphoreFactory::deleteMutex(SemaphoreIF* semaphore) {
|
||||
delete semaphore;
|
||||
}
|
Reference in New Issue
Block a user