reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
reaction_t Struct Reference

Reaction activation record to push onto the reaction queue. More...

#include <lf_types.h>

Data Fields

interval_t deadline
 Deadline relative to the reaction's invocation time.
reaction_function_t deadline_violation_handler
 Function to handle deadline violations.
reaction_function_t function
 The reaction function to be executed.
index_t index
 Inverse priority determined by dependency analysis.
bool is_an_input_reaction
 Flag indicating if this is a network input reaction.
bool is_STP_violated
 Flag indicating STP violation in input triggers.
reaction_tlast_enabling_reaction
 Pointer to the last enabling reaction.
reactor_mode_tmode
 Pointer to the enclosing mode of this reaction.
const char * name
 Full name of the reaction for logging purposes.
size_t num_outputs
 Number of outputs that may be produced by this reaction.
int number
 The reaction number within its reactor.
bool ** output_produced
 Array of pointers to booleans indicating output production.
size_t pos
 Current position in the priority queue.
void * self
 Pointer to the reactor's state struct.
reaction_status_t status
 Current status of the reaction.
reaction_function_t STP_handler
 Function to handle STP violations.
int * triggered_sizes
 Array of trigger counts per output.
trigger_t *** triggers
 Array of trigger arrays for each output.
size_t worker_affinity
 Worker thread affinity suggestion.

Detailed Description

Reaction activation record to push onto the reaction queue.

Some of the information in this struct is common among all instances of the reactor, and some is specific to each particular instance. These are marked below COMMON or INSTANCE accordingly. The COMMON information is set in the constructor. The fields marked RUNTIME have values that change during execution. Instances of this struct are put onto the reaction queue by the scheduler.

Field Documentation

◆ deadline

interval_t reaction_t::deadline

Deadline relative to the reaction's invocation time.

INSTANCE: Specific to each reactor instance. Used to detect deadline violations.

◆ deadline_violation_handler

reaction_function_t reaction_t::deadline_violation_handler

Function to handle deadline violations.

COMMON: Set during reactor construction. Called when the reaction's deadline is violated.

◆ function

reaction_function_t reaction_t::function

The reaction function to be executed.

COMMON: Set during reactor construction. This is the actual function that implements the reaction's behavior.

◆ index

index_t reaction_t::index

Inverse priority determined by dependency analysis.

INSTANCE: Specific to each reactor instance. Used by the scheduler to determine execution order.

◆ is_an_input_reaction

bool reaction_t::is_an_input_reaction

Flag indicating if this is a network input reaction.

COMMON: Set during reactor construction. True if this reaction is a network input reaction of a federate. Default is false.

◆ is_STP_violated

bool reaction_t::is_STP_violated

Flag indicating STP violation in input triggers.

COMMON: Set during reactor construction. True if any trigger to this reaction was triggered at a later logical time than originally anticipated. Currently only possible with logical connections in decentralized federated execution.

◆ last_enabling_reaction

reaction_t* reaction_t::last_enabling_reaction

Pointer to the last enabling reaction.

INSTANCE: Specific to each reactor instance. Points to the last reaction that enables this one, or NULL if none. Used for optimization purposes.

◆ mode

reactor_mode_t* reaction_t::mode

Pointer to the enclosing mode of this reaction.

COMMON: Set during reactor construction. If the reaction is enclosed in multiple modes, this points to the innermost mode. Only present when modal reactors are enabled.

◆ name

const char* reaction_t::name

Full name of the reaction for logging purposes.

COMMON: Set during reactor construction. Points to the full name of the reactor followed by the reaction number. Only used when logging level is set to LOG or higher.

◆ num_outputs

size_t reaction_t::num_outputs

Number of outputs that may be produced by this reaction.

COMMON: Set during reactor construction. Defines the size of the output_produced array.

◆ number

int reaction_t::number

The reaction number within its reactor.

INSTANCE: Specific to each reactor instance. Zero-based index indicating the reaction's position in the reactor.

◆ output_produced

bool** reaction_t::output_produced

Array of pointers to booleans indicating output production.

COMMON: Set during reactor construction. Each element indicates whether the corresponding output was produced.

◆ pos

size_t reaction_t::pos

Current position in the priority queue.

RUNTIME: Changes during execution. Used by the scheduler to track the reaction's position in the queue.

◆ self

void* reaction_t::self

Pointer to the reactor's state struct.

INSTANCE: Specific to each reactor instance. Contains the state variables and other instance-specific data.

◆ status

reaction_status_t reaction_t::status

Current status of the reaction.

RUNTIME: Changes during execution. Indicates whether the reaction is inactive, queued, or running.

See also
reaction_status_t for possible values.

◆ STP_handler

reaction_function_t reaction_t::STP_handler

Function to handle STP violations.

COMMON: Set during reactor construction. Called when a trigger to this reaction was triggered at a later logical time than originally intended. Currently only possible with logical connections in decentralized federated execution.

◆ triggered_sizes

int* reaction_t::triggered_sizes

Array of trigger counts per output.

INSTANCE: Specific to each reactor instance. Contains the number of triggers for each output port.

◆ triggers

trigger_t*** reaction_t::triggers

Array of trigger arrays for each output.

INSTANCE: Specific to each reactor instance. Three-dimensional array: [output][trigger_count][trigger] Contains pointers to all triggers that are triggered by each output.

◆ worker_affinity

size_t reaction_t::worker_affinity

Worker thread affinity suggestion.

RUNTIME: Changes during execution. The worker number of the thread that scheduled this reaction. Used as a suggestion to the scheduler for thread assignment.


The documentation for this struct was generated from the following file:
  • /Users/runner/work/reactor-c/reactor-c/include/core/lf_types.h