#include "Mutex.h"
#include "../../serviceinterface/ServiceInterfaceStream.h"
Mutex::Mutex() {}
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
if(timeoutType == TimeoutType::BLOCKING) {
mutex.lock();
return HasReturnvaluesIF::RETURN_OK;
}
else if(timeoutType == TimeoutType::POLLING) {
if(mutex.try_lock()) {
else if(timeoutType == TimeoutType::WAITING){
auto chronoMs = std::chrono::milliseconds(timeoutMs);
if(mutex.try_lock_for(chronoMs)) {
return MutexIF::MUTEX_TIMEOUT;
ReturnValue_t Mutex::unlockMutex() {
mutex.unlock();
std::timed_mutex* Mutex::getMutexHandle() {
return &mutex;