Skip to content

Commit b0cb444

Browse files
committed
[occ] Stop iterating in RUNNING after END_OF_DATA event raised
1 parent 6bf15f9 commit b0cb444

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

occ/occlib/OccServer.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ bool OccServer::checkMachineDone()
383383

384384
void OccServer::runChecker()
385385
{
386+
bool endOfData = false;
386387
while (!m_destroying) {
387388
m_mu.lock();
388389

@@ -394,9 +395,10 @@ void OccServer::runChecker()
394395
}
395396

396397
// execute periodic actions, as defined for t_State::running
397-
if (currentState == t_State::running) {
398+
if (currentState == t_State::running && !endOfData) {
398399
int err = m_rco->iterateRunning();
399400
if (err == 1) { // signal EndOfData event
401+
endOfData = true;
400402
auto eodEvent = new pb::DeviceEvent;
401403
eodEvent->set_type(pb::END_OF_DATA);
402404
pushEvent(eodEvent);

occ/occlib/RuntimeControlledObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ class OCC_EXPORT RuntimeControlledObject {
166166
*
167167
* @return 0 if the operation completed successfully and the machine can stay in the running state,
168168
* 1 if all data processing is done and the implementer wishes to notify the machine control
169-
* mechanism of this condition, or any other value which immediately triggers a transition to
170-
* the error state.
169+
* mechanism of this condition (send END_OF_DATA event), or any other value which immediately
170+
* triggers a transition to the error state.
171171
*
172172
* This function is called continuously by OccServer::runChecker if the state machine is in the
173173
* state t_State::running. It is never called outside this state.

0 commit comments

Comments
 (0)