Remove stopEvent signal, because the mutex lock control the acq thread loop

This commit is contained in:
Douglas Araujo
2022-09-14 16:33:03 +02:00
committed by Iocuser
parent ab61e952e1
commit 1a87d62bc5
2 changed files with 6 additions and 26 deletions
+5 -24
View File
@@ -52,20 +52,13 @@ Hama::Hama(const char* portName, int cameraId, int maxBuffers, size_t maxMemory,
stopThread = 0;
/* Create the epicsEvents for signaling to task when acquisition starts and stops */
startAcquireEventId_ = epicsEventCreate(epicsEventEmpty);
if (!startAcquireEventId_) {
startEvent_ = epicsEventCreate(epicsEventEmpty);
if (!startEvent_) {
printf("%s:%s epicsEventCreate failure for acquire start event\n",
driverName, functionName);
return;
}
stopAcquireEventId_ = epicsEventCreate(epicsEventEmpty);
if (!stopAcquireEventId_) {
printf("%s:%s epicsEventCreate failure for acquire stop event\n",
driverName, functionName);
return;
}
//General
createParam( HamaName, asynParamOctet, &hHamaName);
@@ -504,7 +497,7 @@ epicsTimeStamp imageStamp;
puts("Waiting start");
unlock();
status = epicsEventWait(startAcquireEventId_);
status = epicsEventWait(startEvent_);
puts("Starting request received");
lock();
@@ -515,7 +508,6 @@ epicsTimeStamp imageStamp;
status = startAcquire();
printf("Status: %d\n", status);
if (status != asynSuccess) {
epicsEventSignal(this->stopAcquireEventId_);
acquireStatusError = 1;
epicsThreadSleep(.1);
}
@@ -525,16 +517,6 @@ epicsTimeStamp imageStamp;
epicsTimeGetCurrent(&startTime);
prevAcquisitionCount = 0;
}
}
eventStatus = epicsEventWaitWithTimeout(this->stopAcquireEventId_, 0);
/* Stop event detected */
if (eventStatus == epicsEventWaitOK) {
setShutter(0);
setIntegerParam(ADAcquire, 0);
acquire=0;
callParamCallbacks();
continue;
}
/* Added this delay for the thread not to hog the processor. No need to run on full speed. */
@@ -660,12 +642,11 @@ asynStatus Hama::writeInt32(asynUser *pasynUser, epicsInt32 value){
if (value) {
/* Send an event to wake up the acq task.*/
puts("Requested acquire start event. Sending acquire start event signal to thread");
epicsEventSignal(this->startAcquireEventId_);
epicsEventSignal(this->startEvent_);
}
else if (!value && (adstatus == ADStatusAcquire || adstatus == ADStatusError)) {
/* This was a command to stop acquisition */
puts("Requested acquire stop event. Sending acquire stop event signal to thread");
epicsEventSignal(this->stopAcquireEventId_);
setShutter(0);
stopAcquire();
}
+1 -2
View File
@@ -264,8 +264,7 @@ private:
int m_id;
int stopThread;
epicsEventId startAcquireEventId_;
epicsEventId stopAcquireEventId_;
epicsEventId startEvent_;
asynStatus startAcquire(void);
asynStatus stopAcquire(void);