fsfw/osal/linux/SemaphoreFactory.cpp

38 lines
1023 B
C++
Raw Normal View History

2020-05-27 00:28:13 +02:00
#include <framework/tasks/SemaphoreFactory.h>
2020-05-29 00:50:44 +02:00
#include <framework/osal/linux/BinarySemaphore.h>
2020-05-27 00:28:13 +02:00
#include <framework/serviceinterface/ServiceInterfaceStream.h>
const uint32_t SemaphoreIF::NO_TIMEOUT = 0;
2020-05-27 11:48:11 +02:00
const uint32_t SemaphoreIF::MAX_TIMEOUT = 0xFFFFFFFF;
2020-05-27 00:28:13 +02:00
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
SemaphoreFactory::SemaphoreFactory() {
}
SemaphoreFactory::~SemaphoreFactory() {
delete factoryInstance;
}
SemaphoreFactory* SemaphoreFactory::instance() {
if (factoryInstance == nullptr){
factoryInstance = new SemaphoreFactory();
}
return SemaphoreFactory::factoryInstance;
}
2020-05-29 00:47:54 +02:00
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t arguments) {
2020-05-29 00:50:44 +02:00
return new BinarySemaphore();
2020-05-27 00:28:13 +02:00
}
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t count,
2020-05-29 00:47:54 +02:00
uint8_t initCount, uint32_t arguments) {
2020-05-27 00:28:13 +02:00
sif::error << "Counting Semaphore not implemented for "
"Linux yet" << std::endl;
return nullptr;
}
2020-05-29 00:47:54 +02:00
void SemaphoreFactory::deleteSemaphore(SemaphoreIF* semaphore) {
2020-05-27 00:28:13 +02:00
delete semaphore;
}