Commit d2fa461b authored by kpetersn's avatar kpetersn
Browse files

Added locks around API calls, which doesn't solve the problem of the IOC crashing on SIGPWR signal

parent 45328f8e
...@@ -73,7 +73,9 @@ asynStatus Linkam::connect(asynUser *pasynUser) ...@@ -73,7 +73,9 @@ asynStatus Linkam::connect(asynUser *pasynUser)
*/ */
// OpenComms only works for Windows-style numbering of COM ports // OpenComms only works for Windows-style numbering of COM ports
//commStatus_ = OpenComms(true, 1, 0); //commStatus_ = OpenComms(true, 1, 0);
this->lock();
commStatus_ = OpenCommsFromDevice(true, serialPort_); commStatus_ = OpenCommsFromDevice(true, serialPort_);
this->unlock();
/* We found the controller and everything is OK. Signal to asynManager that we are connected. */ /* We found the controller and everything is OK. Signal to asynManager that we are connected. */
status = pasynManager->exceptionConnect(this->pasynUserSelf); status = pasynManager->exceptionConnect(this->pasynUserSelf);
...@@ -97,7 +99,9 @@ asynStatus Linkam::disconnect(asynUser *pasynUser) ...@@ -97,7 +99,9 @@ asynStatus Linkam::disconnect(asynUser *pasynUser)
// OpenComms only works for Windows-style numbering of COM ports // OpenComms only works for Windows-style numbering of COM ports
//commStatus_ = OpenComms(false, 1, 0); //commStatus_ = OpenComms(false, 1, 0);
this->lock();
commStatus_ = OpenCommsFromDevice(false, serialPort_); commStatus_ = OpenCommsFromDevice(false, serialPort_);
this->unlock();
/* We found the controller and everything is OK. Signal to asynManager that we are connected. */ /* We found the controller and everything is OK. Signal to asynManager that we are connected. */
status = pasynManager->exceptionDisconnect(this->pasynUserSelf); status = pasynManager->exceptionDisconnect(this->pasynUserSelf);
...@@ -158,7 +162,9 @@ asynStatus Linkam::readTemperature(epicsFloat64 *value) ...@@ -158,7 +162,9 @@ asynStatus Linkam::readTemperature(epicsFloat64 *value)
{ {
static const char *functionName = "readTemperature"; static const char *functionName = "readTemperature";
this->lock();
*value = GetValue(u32Heater1TempR); *value = GetValue(u32Heater1TempR);
this->unlock();
// There probably isn't a good reason to retain the temperature in a private variable; // There probably isn't a good reason to retain the temperature in a private variable;
// The value is already stored in the parameter library // The value is already stored in the parameter library
temperatureRbv_ = *value; temperatureRbv_ = *value;
...@@ -174,7 +180,9 @@ asynStatus Linkam::readRampLimit(epicsFloat64 *value) ...@@ -174,7 +180,9 @@ asynStatus Linkam::readRampLimit(epicsFloat64 *value)
{ {
static const char *functionName = "readRampLimit"; static const char *functionName = "readRampLimit";
this->lock();
*value = GetValue(u32Heater1LimitRW); *value = GetValue(u32Heater1LimitRW);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n", "%s:%s, port %s, value = %lf\n",
...@@ -187,7 +195,9 @@ asynStatus Linkam::readRampRate(epicsFloat64 *value) ...@@ -187,7 +195,9 @@ asynStatus Linkam::readRampRate(epicsFloat64 *value)
{ {
static const char *functionName = "readRampRate"; static const char *functionName = "readRampRate";
this->lock();
*value = GetValue(u32Heater1RateRW); *value = GetValue(u32Heater1RateRW);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n", "%s:%s, port %s, value = %lf\n",
...@@ -200,7 +210,9 @@ asynStatus Linkam::readHeaterPower(epicsFloat64 *value) ...@@ -200,7 +210,9 @@ asynStatus Linkam::readHeaterPower(epicsFloat64 *value)
{ {
static const char *functionName = "readHeaterPower"; static const char *functionName = "readHeaterPower";
this->lock();
*value = GetValue(u32Heater1PowerR); *value = GetValue(u32Heater1PowerR);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n", "%s:%s, port %s, value = %lf\n",
...@@ -263,8 +275,10 @@ asynStatus Linkam::setRampLimit(epicsFloat64 value) ...@@ -263,8 +275,10 @@ asynStatus Linkam::setRampLimit(epicsFloat64 value)
* *
* Returns true if set successfully, false otherwise. * Returns true if set successfully, false otherwise.
*/ */
this->lock();
//status = SetValue(u32Heater1LimitRW, (float) value); //status = SetValue(u32Heater1LimitRW, (float) value);
status = SetValue(2, (float) value); status = SetValue(2, (float) value);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n", "%s:%s, port %s, value = %lf\n",
...@@ -278,8 +292,10 @@ asynStatus Linkam::setRampRate(epicsFloat64 value) ...@@ -278,8 +292,10 @@ asynStatus Linkam::setRampRate(epicsFloat64 value)
bool status; bool status;
static const char *functionName = "setRampRate"; static const char *functionName = "setRampRate";
this->lock();
//status = SetValue(u32Heater1RateRW, (float) value); //status = SetValue(u32Heater1RateRW, (float) value);
status = SetValue(1, (float) value); status = SetValue(1, (float) value);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %lf\n", "%s:%s, port %s, value = %lf\n",
...@@ -328,7 +344,9 @@ asynStatus Linkam::setHeating(epicsInt32 value) ...@@ -328,7 +344,9 @@ asynStatus Linkam::setHeating(epicsInt32 value)
bool status; bool status;
static const char *functionName = "setHeating"; static const char *functionName = "setHeating";
this->lock();
status = StartHeating((value==1) ? true : false); status = StartHeating((value==1) ? true : false);
this->unlock();
asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER, asynPrint(this->pasynUserSelf, ASYN_TRACEIO_DRIVER,
"%s:%s, port %s, value = %d\n", "%s:%s, port %s, value = %d\n",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment