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

Execution environment. More...

#include <environment.h>

Data Fields

trigger_handle_t _lf_handle
 Handle for the environment's trigger.
tag_t ** _lf_intended_tag_fields
 Array of intended tag fields for federated execution.
int _lf_intended_tag_fields_size
 Number of intended tag fields allocated.
lf_tag_advancement_barrier_t barrier
 Barrier for tag advancement.
tag_t current_tag
 The current logical tag being processed.
interval_t duration
 The duration of the environment, which is the time interval between the start tag and the stop tag.
enclave_info_tenclave_info
 Information about the scheduling enclave.
pqueue_tag_tevent_q
 Priority queue for pending events.
lf_cond_t event_q_changed
 Condition variable for event queue changes.
bool execution_started
 Indicates whether execution has started.
lf_cond_t global_tag_barrier_requestors_reached_zero
 Condition variable for tag barrier requestors.
int id
 Unique numeric identifier for this environment.
bool initialized
 Indicates whether the environment has been initialized.
bool ** is_present_fields
 Array of is_present fields for ports.
bool ** is_present_fields_abbreviated
 Abbreviated version of is_present fields.
int is_present_fields_abbreviated_size
 Number of abbreviated is_present fields allocated.
int is_present_fields_size
 Number of is_present fields allocated.
mode_environment_tmodes
 Mode environment for modal reactors.
lf_mutex_t mutex
 Mutex for synchronizing access to the environment.
char * name
 Name identifier for this environment.
bool need_to_send_LTC
 Flag indicating if a logical tag complete (LTC) message needs to be sent.
int num_workers
 Number of worker threads.
pqueue_tag_trecycle_q
 Priority queue for recycling events.
reaction_t ** reset_reactions
 Array of reset reactions.
int reset_reactions_size
 Number of reset reactions allocated.
lf_scheduler_tscheduler
 Scheduler for managing worker threads.
reaction_t ** shutdown_reactions
 Array of shutdown reactions.
int shutdown_reactions_size
 Number of shutdown reactions allocated.
vector_t sparse_io_record_sizes
 Vector storing sizes of sparse I/O records.
tag_t start_tag
 The start tag of the environment.
reaction_t ** startup_reactions
 Array of startup reactions.
int startup_reactions_size
 Number of startup reactions allocated.
tag_t stop_tag
 The tag at which execution should stop.
lf_thread_t * thread_ids
 Array of worker thread IDs.
trigger_t ** timer_triggers
 Array of timer triggers.
int timer_triggers_size
 Number of timer triggers allocated.
watchdog_t ** watchdogs
 Array of watchdog timers.
int watchdogs_size
 Number of watchdogs allocated.
int worker_thread_count
 Number of worker threads in this environment.

Detailed Description

Execution environment.

This struct contains information about the execution environment. An execution environment maintains a notion of a "current tag" and has its own event queue and scheduler. Normally, there is only one execution environment, but if you use scheduling enclaves, then there will be one for each enclave.

Field Documentation

◆ _lf_handle

trigger_handle_t environment_t::_lf_handle

Handle for the environment's trigger.

Used to identify and manage the environment's trigger in the runtime system.

◆ _lf_intended_tag_fields

tag_t** environment_t::_lf_intended_tag_fields

Array of intended tag fields for federated execution.

Used to track the intended logical tags for each federate in a distributed system. The size is stored in _lf_intended_tag_fields_size.

Note
Only used in federated execution.

◆ _lf_intended_tag_fields_size

int environment_t::_lf_intended_tag_fields_size

Number of intended tag fields allocated.

Indicates the size of the _lf_intended_tag_fields array.

Note
Only used in federated execution.

◆ barrier

lf_tag_advancement_barrier_t environment_t::barrier

Barrier for tag advancement.

Ensures all worker threads have completed processing the current tag before advancing to the next tag.

◆ current_tag

tag_t environment_t::current_tag

The current logical tag being processed.

Represents the current logical time and microstep being executed in this environment.

◆ duration

interval_t environment_t::duration

The duration of the environment, which is the time interval between the start tag and the stop tag.

◆ enclave_info

enclave_info_t* environment_t::enclave_info

Information about the scheduling enclave.

Contains configuration and state specific to the scheduling enclave this environment belongs to.

Note
Only used in enclave execution.

◆ event_q

pqueue_tag_t* environment_t::event_q

Priority queue for pending events.

Stores events ordered by their logical tags. Events are processed in tag order, with earlier tags taking precedence.

◆ event_q_changed

lf_cond_t environment_t::event_q_changed

Condition variable for event queue changes.

Used to notify worker threads when the event queue has been modified.

◆ execution_started

bool environment_t::execution_started

Indicates whether execution has started.

Set to true when events at the start tag have been pulled from the event queue. Used to track the execution state of the environment.

◆ global_tag_barrier_requestors_reached_zero

lf_cond_t environment_t::global_tag_barrier_requestors_reached_zero

Condition variable for tag barrier requestors.

Used to coordinate tag advancement when all requestors have reached zero.

◆ id

int environment_t::id

Unique numeric identifier for this environment.

Used to distinguish between different environments, particularly in multi-enclave setups.

◆ initialized

bool environment_t::initialized

Indicates whether the environment has been initialized.

Set to true after environment_init() completes successfully. Used to prevent multiple initializations and ensure proper setup.

◆ is_present_fields

bool** environment_t::is_present_fields

Array of is_present fields for ports.

Tracks whether each port has a value present at the current tag. The size of this array is stored in is_present_fields_size.

◆ is_present_fields_abbreviated

bool** environment_t::is_present_fields_abbreviated

Abbreviated version of is_present fields.

Used for optimization when tracking port presence. The size of this array is stored in is_present_fields_abbreviated_size.

◆ is_present_fields_abbreviated_size

int environment_t::is_present_fields_abbreviated_size

Number of abbreviated is_present fields allocated.

Indicates the size of the is_present_fields_abbreviated array.

◆ is_present_fields_size

int environment_t::is_present_fields_size

Number of is_present fields allocated.

Indicates the size of the is_present_fields array.

◆ modes

mode_environment_t* environment_t::modes

Mode environment for modal reactors.

Contains state and configuration for modal reactors in this environment.

◆ mutex

lf_mutex_t environment_t::mutex

Mutex for synchronizing access to the environment.

Used to protect shared data structures and ensure thread-safe operations.

◆ name

char* environment_t::name

Name identifier for this environment.

Used for debugging and tracing purposes. Should be unique across all environments in the program.

◆ need_to_send_LTC

bool environment_t::need_to_send_LTC

Flag indicating if a logical tag complete (LTC) message needs to be sent.

Used in federated execution to coordinate tag advancement between federates.

Note
Only used in federated execution.

◆ num_workers

int environment_t::num_workers

Number of worker threads.

Indicates the total number of worker threads available for parallel execution in this environment.

◆ recycle_q

pqueue_tag_t* environment_t::recycle_q

Priority queue for recycling events.

Used to efficiently reuse event structures after they have been processed, reducing memory allocation overhead.

◆ reset_reactions

reaction_t** environment_t::reset_reactions

Array of reset reactions.

Contains all reactions that should be executed when the environment resets. The size is stored in reset_reactions_size.

◆ reset_reactions_size

int environment_t::reset_reactions_size

Number of reset reactions allocated.

Indicates the size of the reset_reactions array.

◆ scheduler

lf_scheduler_t* environment_t::scheduler

Scheduler for managing worker threads.

Responsible for assigning reactions to worker threads and managing their execution.

◆ shutdown_reactions

reaction_t** environment_t::shutdown_reactions

Array of shutdown reactions.

Contains all reactions that should be executed when the environment shuts down. The size is stored in shutdown_reactions_size.

◆ shutdown_reactions_size

int environment_t::shutdown_reactions_size

Number of shutdown reactions allocated.

Indicates the size of the shutdown_reactions array.

◆ sparse_io_record_sizes

vector_t environment_t::sparse_io_record_sizes

Vector storing sizes of sparse I/O records.

Used to track the size of I/O records for each port in sparse I/O mode.

◆ start_tag

tag_t environment_t::start_tag

The start tag of the environment.

◆ startup_reactions

reaction_t** environment_t::startup_reactions

Array of startup reactions.

Contains all reactions that should be executed when the environment starts. The size is stored in startup_reactions_size.

◆ startup_reactions_size

int environment_t::startup_reactions_size

Number of startup reactions allocated.

Indicates the size of the startup_reactions array.

◆ stop_tag

tag_t environment_t::stop_tag

The tag at which execution should stop.

When current_tag reaches this value, execution will terminate after processing all events at this tag.

◆ thread_ids

lf_thread_t* environment_t::thread_ids

Array of worker thread IDs.

Stores the thread identifiers for all worker threads in this environment.

◆ timer_triggers

trigger_t** environment_t::timer_triggers

Array of timer triggers.

Stores all timer triggers associated with this environment. The size of this array is stored in timer_triggers_size.

◆ timer_triggers_size

int environment_t::timer_triggers_size

Number of timer triggers allocated.

Indicates the size of the timer_triggers array.

◆ watchdogs

watchdog_t** environment_t::watchdogs

Array of watchdog timers.

Contains all watchdog timers associated with this environment for monitoring execution progress.

◆ watchdogs_size

int environment_t::watchdogs_size

Number of watchdogs allocated.

Indicates the size of the watchdogs array.

◆ worker_thread_count

int environment_t::worker_thread_count

Number of worker threads in this environment.

Indicates how many threads are available for parallel execution of reactions.


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