increaed exception safety
This commit is contained in:
parent
a56cf43897
commit
227074fd4d
@ -37,15 +37,20 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
|||||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
<< "which is the NO_PARAMETER value!" << std::endl;
|
"which is the NO_PARAMETER value!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||||
|
"which is the NO_PARAMETER value!\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(poolOwner);
|
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(poolOwner);
|
||||||
if(hkOwner == nullptr) {
|
if(hkOwner == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "LocalPoolVariable: The supplied pool owner did not "
|
sif::error << "LocalPoolVariable: The supplied pool owner did not implement the correct "
|
||||||
<< "implement the correct interface"
|
"interface HasLocalDataPoolIF!" << std::endl;
|
||||||
<< " HasLocalDataPoolIF!" << std::endl;
|
#else
|
||||||
|
sif::printError( "LocalPoolVariable: The supplied pool owner did not implement the correct "
|
||||||
|
"interface HasLocalDataPoolIF!\n");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -26,8 +26,17 @@ inline LocalPoolVariable<T>::LocalPoolVariable(gp_id_t globalPoolId,
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVariable<T>::read(
|
inline ReturnValue_t LocalPoolVariable<T>::read(
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
if(hkManager == nullptr) {
|
||||||
return readWithoutLock();
|
return readWithoutLock();
|
||||||
|
}
|
||||||
|
MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager);
|
||||||
|
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = readWithoutLock();
|
||||||
|
mutex->unlockMutex();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -65,8 +74,17 @@ inline ReturnValue_t LocalPoolVariable<T>::commit(bool setValid,
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline ReturnValue_t LocalPoolVariable<T>::commit(
|
inline ReturnValue_t LocalPoolVariable<T>::commit(
|
||||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||||
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
if(hkManager == nullptr) {
|
||||||
return commitWithoutLock();
|
return commitWithoutLock();
|
||||||
|
}
|
||||||
|
MutexIF* mutex = LocalDpManagerAttorney::getMutexHandle(*hkManager);
|
||||||
|
ReturnValue_t result = mutex->lockMutex(timeoutType, timeoutMs);
|
||||||
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = commitWithoutLock();
|
||||||
|
mutex->unlockMutex();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
Loading…
Reference in New Issue
Block a user