Managing Reactions

During system runtime, executing reactions can be managed via the reaction handle. A reaction handle is provided for any binding On Statements. Once an on statement has been bound, the reaction handle will be enabled. If necessary, reactions can toggle between enabled and disabled during runtime.

The reaction handle provides the following functions for managing a reaction:

disable

ReactionHandle &NUClear::threading::ReactionHandle::disable()

Disables the reaction.

When disabled, any associated tasks will not be created if triggered. All reaction configuration is still available, so that the reaction can be enabled when required. Note that a reaction which has been bound by an on<Always> request should not be disabled.

enable

ReactionHandle &NUClear::threading::ReactionHandle::enable()

Enables the reaction so that associated tasks will be scheduled and queued when the reaction is triggered.

enable(bool set)

Warning

doxygenfunction: Unable to resolve multiple matches for function “NUClear::threading::ReactionHandle::enable” with arguments (bool) in doxygen xml output for project “NUClear” from directory: doxygen. Potential matches:

- ReactionHandle &enable()
- ReactionHandle &enable(const bool &set)

enabled

bool NUClear::threading::ReactionHandle::enabled() const

Informs if the reaction is currently enabled.

Return

true if enabled, false if disabled

unbind

void NUClear::threading::ReactionHandle::unbind()

Removes a reaction request from the runtime environment.

This action is not reversible, once a reaction has been unbound, it is no longer available for further use during the instance of runtime. This is most commonly used for the unbinding of network configuration before attempting to re-set configuration details during runtime.