Overview

This event offers the process the chance to perform any termination that must occur as soon as possible (in the wallclock sense) after ceasing a bout of processing. This same event is sent sequentially to all processes in the same run-thread (and not forgetting that other processes in other run-threads may be competing for the same resources). Therefore, the process should do the ABSOLUTE MINIMUM of processing whilst servicing this event: the longer the process takes, the less true to specification this event is for affected processes. Correspondingly, the process cannot absolutely assume that this event will occur immediately after a processing bout, but it is the closest thing it will get to that.

Expensive termination processing that must be performed in the run-phase environment should be performed during EVENT_RUN_STOP.

Warnings
  • Note that following this event, the process may not receive further events for an arbitrary length of time. Therefore, this will be your one and only opportunity to put paid to halt any processes that may have safety implications.

Context

This event is fired once every time the system is moved out of stepping mode, which may be more than once per instantiation.

Action

  • Perform any termination that must be performed as near to run-phase as possible. For instance, stop wallclock or hardware timers.
  • Halt any hardware that should not be allowed to proceed unsupervised, for example tell The Giant Killer Robot to stop inexorably approaching The Defenceless Kitten.

Example

C++ Source Code (against 1199)
case EVENT_RUN_PAUSE: { // anything that needs doing asap // after execution is halted myHardwareTimer.stop(); // halt motors etc., since you may not // get another event call for a long time giantKillerRobot.stopApproaching( DefencelessKitten ); // event was processed ok event.response = C_OK; break; }