Previous: Returning Control from a Node, Up: Transferring Control between Nodes [Contents][Index]
Model execution terminates after processing all input data or performing a course of interaction with external entities—all nodes return control, and the node call stack becomes empty.
The model instance has a flag indicating whether or not to continue model execution: a non-zero flag indicates to continue model execution, and zero flag indicates to terminate model execution with reporting success.
The function qsmm_engine_create
initializes the flag to a non-zero value when creating the model instance.
Use the following functions to query or set the flag.
This function returns the flag specifying whether or not to continue the execution of a multinode model.
If the function returns a positive value, model execution continues.
If the function returns zero, model execution terminates.
If the model instance does not exist, the function returns negative error code QSMM_ERR_UNTIMELY
.
This function sets the flag specifying whether or not to continue the execution of a multinode model. If flag is non-zero, model execution continues. If flag is zero, model execution terminates.
On success, the function returns a non-negative value.
If the model instance does not exist, the function returns negative error code QSMM_ERR_UNTIMELY
.
Zero flag causes returning from all nested calls to the function qsmm_node_call_default
as if after calling the function qsmm_return_to_caller_node
in the event handlers of instruction meta-classes on processing an event QSMM_EVT_ACTIVATE
for all nodes in the node call stack.
The function qsmm_node_call_default
checks the flag at the beginning of its execution, and, if the flag is zero, the function exits immediately.
That function also checks the flag (and possibly exits) after sending an event QSMM_EVT_NODE_ENTER
to the instruction class set and after sending an event QSMM_EVT_ACTIVATE
to an instruction meta-class.
The event handler of an instruction meta-class can analyze the flag explicitly by calling the function qsmm_get_continue
after a call to qsmm_node_call_default
while processing an event QSMM_EVT_ACTIVATE
to perform immediate exit from the event handler in case of terminating model execution.
Use the following macro to set the flag to zero.
This macro expands to:
qsmm_set_continue((qsmm), 0)
You can use this macro to terminate the execution of a multinode model from within an event handler, where its argument qsmm
is equal to the handle of this multinode model.
For example, you can call this macro in a block of code handling the invocation of an instruction (in the event handler of an instruction meta-class on processing an event QSMM_EVT_ACTIVATE
) to terminate the execution of a multinode model when the instruction fetches all input data of this multinode model.
Previous: Returning Control from a Node, Up: Transferring Control between Nodes [Contents][Index]