add some thread safety
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
014ac8b8c2
commit
353b9bd322
@ -47,15 +47,25 @@ ReturnValue_t RwPollingTask::performOperation(uint8_t operationCode) {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
acs::SimpleSensorMode currentMode;
|
||||||
|
rws::SpecialRwRequest specialRequest;
|
||||||
|
bool doSetSpeed;
|
||||||
|
|
||||||
for (unsigned idx = 0; idx < rwCookies.size(); idx++) {
|
for (unsigned idx = 0; idx < rwCookies.size(); idx++) {
|
||||||
if (rwRequests[idx].mode == acs::SimpleSensorMode::OFF) {
|
{
|
||||||
|
MutexGuard mg(ipcLock);
|
||||||
|
currentMode = rwRequests[idx].mode;
|
||||||
|
specialRequest = rwRequests[idx].specialRequest;
|
||||||
|
doSetSpeed = rwRequests[idx].setSpeed;
|
||||||
|
}
|
||||||
|
if (currentMode == acs::SimpleSensorMode::OFF) {
|
||||||
skipCommandingForRw[idx] = true;
|
skipCommandingForRw[idx] = true;
|
||||||
} else if (rwRequests[idx].specialRequest == rws::SpecialRwRequest::RESET_MCU) {
|
} else if (specialRequest == rws::SpecialRwRequest::RESET_MCU) {
|
||||||
prepareSimpleCommand(rws::RESET_MCU);
|
prepareSimpleCommand(rws::RESET_MCU);
|
||||||
// No point in commanding that specific RW for the cycle.
|
// No point in commanding that specific RW for the cycle.
|
||||||
skipCommandingForRw[idx] = true;
|
skipCommandingForRw[idx] = true;
|
||||||
writeOneRwCmd(idx, fd);
|
writeOneRwCmd(idx, fd);
|
||||||
} else if (rwRequests[idx].setSpeed) {
|
} else if (doSetSpeed) {
|
||||||
prepareSetSpeedCmd(idx);
|
prepareSetSpeedCmd(idx);
|
||||||
if (writeOneRwCmd(idx, fd) != returnvalue::OK) {
|
if (writeOneRwCmd(idx, fd) != returnvalue::OK) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user