From a795252e38b500af8a7474d86fb0f0644df42a07 Mon Sep 17 00:00:00 2001 From: Kevin Peterson Date: Mon, 1 Nov 2021 12:57:40 -0500 Subject: [PATCH] Added locks around writeReadController to prevent calls from the profile thread while the poller thread is calling writeReadBinary with cleared terminators. --- acsMotionApp/src/SPiiPlusDriver.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/acsMotionApp/src/SPiiPlusDriver.cpp b/acsMotionApp/src/SPiiPlusDriver.cpp index 323f111..eb80f3b 100644 --- a/acsMotionApp/src/SPiiPlusDriver.cpp +++ b/acsMotionApp/src/SPiiPlusDriver.cpp @@ -354,7 +354,9 @@ asynStatus SPiiPlusController::writeReadInt(std::stringstream& cmd, int* val) asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: output = %s\n", driverName, functionName, cmd.str().c_str()); size_t response; + lock(); asynStatus status = this->writeReadController(cmd.str().c_str(), inString, 256, &response, -1); + unlock(); asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: input = %s\n", driverName, functionName, inString); asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: status = %i\n", driverName, functionName, status); @@ -401,7 +403,9 @@ asynStatus SPiiPlusController::writeReadDouble(std::stringstream& cmd, double* v asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: output = %s\n", driverName, functionName, cmd.str().c_str()); size_t response; + lock(); asynStatus status = this->writeReadController(cmd.str().c_str(), inString, 256, &response, -1); + unlock(); asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: input = %s\n", driverName, functionName, inString); asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: status = %i\n", driverName, functionName, status); @@ -449,7 +453,9 @@ asynStatus SPiiPlusController::writeReadAck(std::stringstream& cmd) asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: output = %s\n", driverName, functionName, cmd.str().c_str()); size_t response; + lock(); asynStatus status = this->writeReadController(cmd.str().c_str(), inString, 256, &response, -1); + unlock(); asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: input = %s\n", driverName, functionName, inString); asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, "%s:%s: status = %i\n", driverName, functionName, status);