added mutex IF timeout name

This commit is contained in:
2020-06-04 20:20:38 +02:00
parent 56340bb8b6
commit 869700e6f5
7 changed files with 28 additions and 24 deletions

View File

@ -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;