improving synchronisation issues
This commit is contained in:
@@ -395,49 +395,48 @@ asynStatus asynStreamGeneratorDriver::writeInt32(asynUser *pasynUser,
|
||||
// TODO should check everything...
|
||||
if (function == P_CountPreset) {
|
||||
if (!currentStatus) {
|
||||
// slightly longer than the status update frequency
|
||||
// i.e. "$(INSTR)$(NAME):RAW-STATUS" SCAN seconds
|
||||
// to ensure that the counts have all had a chance
|
||||
// to update their values before starting a count
|
||||
epicsThreadSleep(0.12); // seconds
|
||||
setIntegerParam(function, value);
|
||||
setIntegerParam(P_Status, STATUS_COUNTING);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
} else {
|
||||
return asynError;
|
||||
}
|
||||
} else if (function == P_TimePreset) {
|
||||
if (!currentStatus) {
|
||||
// slightly longer than the status update frequency
|
||||
// i.e. "$(INSTR)$(NAME):RAW-STATUS" SCAN seconds
|
||||
// to ensure that the counts have all had a chance
|
||||
// to update their values before starting a count
|
||||
epicsThreadSleep(0.12); // seconds
|
||||
setIntegerParam(function, value);
|
||||
setIntegerParam(P_Status, STATUS_COUNTING);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
} else {
|
||||
return asynError;
|
||||
}
|
||||
} else if (function == P_ClearElapsedTime) {
|
||||
if (!currentStatus) {
|
||||
setDoubleParam(P_ElapsedTime, 0);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
} else {
|
||||
return asynError;
|
||||
}
|
||||
} else if (isClearCount) {
|
||||
if (!currentStatus) {
|
||||
setInteger64Param(P_Counts[channelToClear], 0);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
} else {
|
||||
return asynError;
|
||||
}
|
||||
} else if (function == P_Reset) {
|
||||
lock();
|
||||
// TODO should probably set back everything to defaults
|
||||
setIntegerParam(P_Status, STATUS_IDLE);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
unlock();
|
||||
} else if (function == P_Stop) {
|
||||
lock();
|
||||
setIntegerParam(P_Status, STATUS_IDLE);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
unlock();
|
||||
} else if (function == P_MonitorChannel) {
|
||||
if (!currentStatus) {
|
||||
setIntegerParam(function, value);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
} else {
|
||||
return asynError;
|
||||
}
|
||||
@@ -457,7 +456,7 @@ asynStatus asynStreamGeneratorDriver::writeInt32(asynUser *pasynUser,
|
||||
}
|
||||
} else {
|
||||
setIntegerParam(function, value);
|
||||
status = (asynStatus)callParamCallbacks();
|
||||
//status = (asynStatus)callParamCallbacks();
|
||||
}
|
||||
|
||||
if (status)
|
||||
@@ -664,7 +663,7 @@ inline void asynStreamGeneratorDriver::queueForKafka(NormalisedEvent &ne) {
|
||||
|
||||
void asynStreamGeneratorDriver::processEvents() {
|
||||
|
||||
// const char functionName[]{"processEvents"};
|
||||
const char functionName[]{"processEvents"};
|
||||
|
||||
// x * number of ids * max events in packet * event size
|
||||
int bufferedEvents = 5 * 10 * 243;
|
||||
@@ -753,6 +752,11 @@ void asynStreamGeneratorDriver::processEvents() {
|
||||
for (std::size_t i = 0; i < this->num_channels; ++i) {
|
||||
counts[i] = 0;
|
||||
}
|
||||
|
||||
// asynPrint(
|
||||
// pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
// "%s:%s: started %"PRIu64" %d\n",
|
||||
// driverName, functionName, (uint64_t) counts[presetChannel], presetChannel);
|
||||
}
|
||||
|
||||
if (currStatus == STATUS_COUNTING) {
|
||||
@@ -772,6 +776,11 @@ void asynStreamGeneratorDriver::processEvents() {
|
||||
(timePreset && elapsedSeconds > (double)timePreset)) {
|
||||
elapsedSeconds =
|
||||
timePreset == 0 ? elapsedSeconds : timePreset;
|
||||
|
||||
// asynPrint(
|
||||
// pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
// "%s:%s: counted %"PRIu64" %d\n",
|
||||
// driverName, functionName, (uint64_t) counts[presetChannel], presetChannel);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user