From 54edeacb2d20dcd5a01c0a11e3337b18fb3cf364 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 2 Jun 2020 22:25:28 +0200 Subject: [PATCH] changed names for linux --- osal/FreeRTOS/SemaphoreFactory.cpp | 2 +- osal/linux/BinarySemaphore.cpp | 6 +++--- osal/linux/BinarySemaphore.h | 2 +- osal/linux/Clock.cpp | 4 ++-- osal/linux/Mutex.cpp | 5 +++-- osal/linux/SemaphoreFactory.cpp | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osal/FreeRTOS/SemaphoreFactory.cpp b/osal/FreeRTOS/SemaphoreFactory.cpp index caf984f21..78427f6cf 100644 --- a/osal/FreeRTOS/SemaphoreFactory.cpp +++ b/osal/FreeRTOS/SemaphoreFactory.cpp @@ -6,7 +6,7 @@ #include SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; -const uint32_t SemaphoreIF::POLLING= 0; +const uint32_t SemaphoreIF::POLLING = 0; const uint32_t SemaphoreIF::BLOCKING = portMAX_DELAY; static const uint32_t USE_REGULAR_SEMAPHORES = 0; diff --git a/osal/linux/BinarySemaphore.cpp b/osal/linux/BinarySemaphore.cpp index 7c76a5c4f..e2ad9b58a 100644 --- a/osal/linux/BinarySemaphore.cpp +++ b/osal/linux/BinarySemaphore.cpp @@ -27,13 +27,13 @@ BinarySemaphore& BinarySemaphore::operator =( ReturnValue_t BinarySemaphore::acquire(uint32_t timeoutMs) { int result = 0; - if(timeoutMs == SemaphoreIF::NO_TIMEOUT) { + if(timeoutMs == SemaphoreIF::POLLING) { result = sem_trywait(&handle); } - else if(timeoutMs == SemaphoreIF::MAX_TIMEOUT) { + else if(timeoutMs == SemaphoreIF::BLOCKING) { result = sem_wait(&handle); } - else if(timeoutMs > SemaphoreIF::NO_TIMEOUT){ + else if(timeoutMs > SemaphoreIF::POLLING){ timespec timeOut; clock_gettime(CLOCK_REALTIME, &timeOut); uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec; diff --git a/osal/linux/BinarySemaphore.h b/osal/linux/BinarySemaphore.h index 7836cd413..9d4ed1cd4 100644 --- a/osal/linux/BinarySemaphore.h +++ b/osal/linux/BinarySemaphore.h @@ -50,7 +50,7 @@ public: * -@c SemaphoreIF::SEMAPHORE_TIMEOUT on timeout */ ReturnValue_t acquire(uint32_t timeoutMs = - SemaphoreIF::NO_TIMEOUT) override; + SemaphoreIF::BLOCKING) override; /** * Release the binary semaphore. diff --git a/osal/linux/Clock.cpp b/osal/linux/Clock.cpp index 630b2cf4c..eda5b7af5 100644 --- a/osal/linux/Clock.cpp +++ b/osal/linux/Clock.cpp @@ -179,7 +179,7 @@ ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){ return HasReturnvaluesIF::RETURN_FAILED; } - ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT); + ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING); if (result != HasReturnvaluesIF::RETURN_OK) { return result; } @@ -194,7 +194,7 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) { if(timeMutex==NULL){ return HasReturnvaluesIF::RETURN_FAILED; } - ReturnValue_t result = timeMutex->lockMutex(MutexIF::NO_TIMEOUT); + ReturnValue_t result = timeMutex->lockMutex(MutexIF::BLOCKING); if (result != HasReturnvaluesIF::RETURN_OK) { return result; } diff --git a/osal/linux/Mutex.cpp b/osal/linux/Mutex.cpp index b47732672..bdcf34390 100644 --- a/osal/linux/Mutex.cpp +++ b/osal/linux/Mutex.cpp @@ -2,7 +2,8 @@ #include #include -const uint32_t MutexIF::NO_TIMEOUT = 0; +const uint32_t MutexIF::BLOCKING = 0xffffffff; +const uint32_t MutexIF::POLLING = 0; uint8_t Mutex::count = 0; @@ -41,7 +42,7 @@ Mutex::~Mutex() { ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) { int status = 0; - if (timeoutMs != MutexIF::NO_TIMEOUT) { + if (timeoutMs != MutexIF::BLOCKING) { timespec timeOut; clock_gettime(CLOCK_REALTIME, &timeOut); uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec; diff --git a/osal/linux/SemaphoreFactory.cpp b/osal/linux/SemaphoreFactory.cpp index 5aec84eae..4fbd60d96 100644 --- a/osal/linux/SemaphoreFactory.cpp +++ b/osal/linux/SemaphoreFactory.cpp @@ -3,8 +3,8 @@ #include #include -const uint32_t SemaphoreIF::NO_TIMEOUT = 0; -const uint32_t SemaphoreIF::MAX_TIMEOUT = 0xFFFFFFFF; +const uint32_t SemaphoreIF::POLLING = 0; +const uint32_t SemaphoreIF::BLOCKING = 0xffffffff; SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;