adapting host osal
This commit is contained in:
@ -1,22 +1,22 @@
|
||||
#include <framework/osal/host/Mutex.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
const uint32_t MutexIF::NO_TIMEOUT = 0;
|
||||
const uint32_t MutexIF::MAX_TIMEOUT = 0xffffffff;
|
||||
const uint32_t MutexIF::POLLING = 0;
|
||||
const uint32_t MutexIF::BLOCKING = 0xffffffff;
|
||||
|
||||
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
if(timeoutMs == MutexIF::MAX_TIMEOUT) {
|
||||
if(timeoutMs == MutexIF::BLOCKING) {
|
||||
mutex.lock();
|
||||
locked = true;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else if(timeoutMs == MutexIF::NO_TIMEOUT) {
|
||||
else if(timeoutMs == MutexIF::POLLING) {
|
||||
if(mutex.try_lock()) {
|
||||
locked = true;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
}
|
||||
else if(timeoutMs > MutexIF::NO_TIMEOUT){
|
||||
else if(timeoutMs > MutexIF::POLLING){
|
||||
auto chronoMs = std::chrono::milliseconds(timeoutMs);
|
||||
if(mutex.try_lock_for(chronoMs)) {
|
||||
locked = true;
|
||||
|
Reference in New Issue
Block a user