WIP: somethings wrong.. #19
@ -25,15 +25,16 @@ BinarySemaphore& BinarySemaphore::operator =(
|
||||
return * this;
|
||||
}
|
||||
|
||||
ReturnValue_t BinarySemaphore::acquire(uint32_t timeoutMs) {
|
||||
ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType,
|
||||
uint32_t timeoutMs) {
|
||||
int result = 0;
|
||||
if(timeoutMs == SemaphoreIF::POLLING) {
|
||||
if(timeoutType == TimeoutType::POLLING) {
|
||||
result = sem_trywait(&handle);
|
||||
}
|
||||
else if(timeoutMs == SemaphoreIF::BLOCKING) {
|
||||
else if(timeoutType == TimeoutType::BLOCKING) {
|
||||
result = sem_wait(&handle);
|
||||
}
|
||||
else if(timeoutMs > SemaphoreIF::POLLING){
|
||||
else if(timeoutType == TimeoutType::WAITING){
|
||||
timespec timeOut;
|
||||
clock_gettime(CLOCK_REALTIME, &timeOut);
|
||||
uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec;
|
||||
|
@ -49,8 +49,8 @@ public:
|
||||
* @return -@c RETURN_OK on success
|
||||
* -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout
|
||||
*/
|
||||
ReturnValue_t acquire(uint32_t timeoutMs =
|
||||
SemaphoreIF::BLOCKING) override;
|
||||
ReturnValue_t acquire(TimeoutType timeoutType = TimeoutType::BLOCKING,
|
||||
uint32_t timeoutMs = 0) override;
|
||||
|
||||
/**
|
||||
* Release the binary semaphore.
|
||||
|
@ -39,8 +39,11 @@ uint32_t FixedTimeslotTask::getPeriodMs() const {
|
||||
|
||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||
uint32_t slotTimeMs, int8_t executionStep) {
|
||||
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||
ExecutableObjectIF* executableObject =
|
||||
objectManager->get<ExecutableObjectIF>(componentId);
|
||||
if (executableObject != nullptr) {
|
||||
pst.addSlot(componentId, slotTimeMs, executionStep,
|
||||
executableObject,this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,6 @@
|
||||
#include "../../osal/linux/CountingSemaphore.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
const uint32_t SemaphoreIF::POLLING = 0;
|
||||
const uint32_t SemaphoreIF::BLOCKING = 0xffffffff;
|
||||
|
||||
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
||||
|
||||
SemaphoreFactory::SemaphoreFactory() {
|
||||
|
Loading…
Reference in New Issue
Block a user