repairing host osal
This commit is contained in:
parent
05814dc805
commit
39b675cf99
@ -122,8 +122,11 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
|
||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||
uint32_t slotTimeMs, int8_t executionStep) {
|
||||
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||
pollingSeqTable.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||
ExecutableObjectIF* executableObject = objectManager->
|
||||
get<ExecutableObjectIF>(componentId);
|
||||
if (executableObject!= nullptr) {
|
||||
pollingSeqTable.addSlot(componentId, slotTimeMs, executionStep,
|
||||
executableObject, this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
|
||||
}
|
||||
// not sure this will work..
|
||||
//*message = std::move(messageQueue.front());
|
||||
MutexHelper mutexLock(queueLock, 20);
|
||||
MutexHelper mutexLock(queueLock, MutexIF::TimeoutType::WAITING, 20);
|
||||
MessageQueueMessage* currentMessage = &messageQueue.front();
|
||||
std::copy(currentMessage->getBuffer(),
|
||||
currentMessage->getBuffer() + messageSize, message->getBuffer());
|
||||
@ -126,7 +126,8 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
||||
}
|
||||
|
||||
if(targetQueue->messageQueue.size() < targetQueue->messageDepth) {
|
||||
MutexHelper mutexLock(targetQueue->queueLock, 20);
|
||||
MutexHelper mutexLock(targetQueue->queueLock,
|
||||
MutexIF::TimeoutType::WAITING, 20);
|
||||
// not ideal, works for now though.
|
||||
MessageQueueMessage* mqmMessage =
|
||||
dynamic_cast<MessageQueueMessage*>(message);
|
||||
@ -146,8 +147,9 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t MessageQueue::lockQueue(dur_millis_t lockTimeout) {
|
||||
return queueLock->lockMutex(lockTimeout);
|
||||
ReturnValue_t MessageQueue::lockQueue(MutexIF::TimeoutType timeoutType,
|
||||
dur_millis_t lockTimeout) {
|
||||
return queueLock->lockMutex(timeoutType, lockTimeout);
|
||||
}
|
||||
|
||||
ReturnValue_t MessageQueue::unlockQueue() {
|
||||
|
@ -182,7 +182,8 @@ public:
|
||||
|
||||
bool isDefaultDestinationSet() const override;
|
||||
|
||||
ReturnValue_t lockQueue(dur_millis_t lockTimeout);
|
||||
ReturnValue_t lockQueue(MutexIF::TimeoutType timeoutType,
|
||||
dur_millis_t lockTimeout);
|
||||
ReturnValue_t unlockQueue();
|
||||
protected:
|
||||
/**
|
||||
|
@ -1,10 +1,9 @@
|
||||
#include "../../osal/host/Mutex.h"
|
||||
#include "Mutex.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
const uint32_t MutexIF::POLLING = 0;
|
||||
const uint32_t MutexIF::BLOCKING = 0xffffffff;
|
||||
Mutex::Mutex() {}
|
||||
|
||||
ReturnValue_t Mutex::lockMutex(uint32_t timeoutMs) {
|
||||
ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||
if(timeoutMs == MutexIF::BLOCKING) {
|
||||
mutex.lock();
|
||||
locked = true;
|
||||
|
@ -15,8 +15,9 @@
|
||||
*/
|
||||
class Mutex : public MutexIF {
|
||||
public:
|
||||
Mutex() = default;
|
||||
ReturnValue_t lockMutex(uint32_t timeoutMs = MutexIF::BLOCKING) override;
|
||||
Mutex();
|
||||
ReturnValue_t lockMutex(TimeoutType timeoutType =
|
||||
TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override;
|
||||
ReturnValue_t unlockMutex() override;
|
||||
|
||||
std::timed_mutex* getMutexHandle();
|
||||
|
@ -37,7 +37,7 @@ ReturnValue_t QueueMapManager::addMessageQueue(
|
||||
|
||||
MessageQueueIF* QueueMapManager::getMessageQueue(
|
||||
MessageQueueId_t messageQueueId) const {
|
||||
MutexHelper(mapLock, 50);
|
||||
MutexHelper(MutexIF::TimeoutType::WAITING, mapLock, 50);
|
||||
auto queueIter = queueMap.find(messageQueueId);
|
||||
if(queueIter != queueMap.end()) {
|
||||
return queueIter->second;
|
||||
|
@ -3,9 +3,6 @@
|
||||
#include "../../osal/linux/CountingSemaphore.h"
|
||||
#include "../../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
const uint32_t SemaphoreIF::POLLING = 0;
|
||||
const uint32_t SemaphoreIF::BLOCKING = 0xFFFFFFFF;
|
||||
|
||||
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
|
||||
|
||||
SemaphoreFactory::SemaphoreFactory() {
|
||||
|
Loading…
Reference in New Issue
Block a user