added mutex IF timeout name
This commit is contained in:
@ -154,7 +154,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;
|
||||
}
|
||||
@ -169,7 +169,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;
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <framework/timemanager/Clock.h>
|
||||
|
||||
const uint32_t MutexIF::NO_TIMEOUT = 0;
|
||||
const uint32_t MutexIF::POLLING = 0;
|
||||
const uint32_t MutexIF::NO_TIMEOUT = 0xffffffff;
|
||||
uint8_t Mutex::count = 0;
|
||||
|
||||
|
||||
@ -39,7 +40,10 @@ Mutex::~Mutex() {
|
||||
|
||||
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
int status = 0;
|
||||
if (timeoutMs != MutexIF::NO_TIMEOUT) {
|
||||
if(timeoutMs == MutexIF::POLLING) {
|
||||
status = pthread_mutex_trylock(&mutex);
|
||||
}
|
||||
else if (timeoutMs != MutexIF::BLOCKING) {
|
||||
timespec timeOut;
|
||||
clock_gettime(CLOCK_REALTIME, &timeOut);
|
||||
uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec;
|
||||
|
Reference in New Issue
Block a user