![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
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_async_state_t * | async_deferred |
| Calls whose resuming reaction has run, waiting for the scheduler to reach their level. | |
| lf_async_physical_owner_t * | async_physical_owners |
| Physical actions passed to lf_async(), and the reaction each is dedicated to. | |
| lf_async_state_t * | async_waiters |
| Pending lf_async() and lf_await() calls in this environment, oldest first. | |
| 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_t * | enclave_info |
| Information about the scheduling enclave. | |
| pqueue_tag_t * | event_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_t * | modes |
| 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_added_workers |
| Number of worker threads added at runtime. | |
| int | num_async_suspended |
| Number of reactions currently suspended in lf_async(). | |
| int | num_async_threads |
| Number of worker threads that have been added by lf_async(). | |
| int | num_workers |
| Number of worker threads. | |
| pqueue_tag_t * | recycle_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_t * | scheduler |
| 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. | |
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.
| 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.
| 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.
| int environment_t::_lf_intended_tag_fields_size |
Number of intended tag fields allocated.
Indicates the size of the _lf_intended_tag_fields array.
| lf_async_state_t* environment_t::async_deferred |
Calls whose resuming reaction has run, waiting for the scheduler to reach their level.
Each entry was unlinked from async_waiters by lf_async_resume() or lf_await_resume() and continues when the scheduler enters the level of its reaction. Protected by the environment mutex.
| lf_async_physical_owner_t* environment_t::async_physical_owners |
Physical actions passed to lf_async(), and the reaction each is dedicated to.
Protected by the environment mutex.
| lf_async_state_t* environment_t::async_waiters |
Pending lf_async() and lf_await() calls in this environment, oldest first.
Each entry is a reaction that is suspended in lf_async(), or whose invoked function has not yet returned, waiting for lf_async_resume() to be called on its action, or a reaction suspended in lf_await() waiting for lf_await_resume() on its port. Protected by the environment mutex.
| 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.
| tag_t environment_t::current_tag |
The current logical tag being processed.
Represents the current logical time and microstep being executed in this environment.
| 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_t* environment_t::enclave_info |
Information about the scheduling enclave.
Contains configuration and state specific to the scheduling enclave this environment belongs to.
| 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.
| 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.
| 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.
| 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.
| int environment_t::id |
Unique numeric identifier for this environment.
Used to distinguish between different environments, particularly in multi-enclave setups.
| 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.
| 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.
| 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.
| 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.
| int environment_t::is_present_fields_size |
Number of is_present fields allocated.
Indicates the size of the is_present_fields array.
| mode_environment_t* environment_t::modes |
Mode environment for modal reactors.
Contains state and configuration for modal reactors in this environment.
| lf_mutex_t environment_t::mutex |
Mutex for synchronizing access to the environment.
Used to protect shared data structures and ensure thread-safe operations.
| char* environment_t::name |
Name identifier for this environment.
Used for debugging and tracing purposes. Should be unique across all environments in the program.
| 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.
| int environment_t::num_added_workers |
Number of worker threads added at runtime.
Counts the worker threads that have been added to this environment by calls to lf_add_worker_thread(). Protected by the environment mutex.
| int environment_t::num_async_suspended |
Number of reactions currently suspended in lf_async().
Each of these has left the pool of worker threads. lf_async() adds a worker thread only when this count would otherwise exceed num_async_threads, so that the pool never shrinks below its original size while growing by no more than the maximum number of concurrent lf_async() calls. Protected by the environment mutex.
| int environment_t::num_async_threads |
Number of worker threads that have been added by lf_async().
Protected by the environment mutex.
| int environment_t::num_workers |
Number of worker threads.
Indicates the total number of worker threads available for parallel execution in this environment. This includes any worker threads added at runtime with lf_add_worker_thread().
| 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.
| 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.
| int environment_t::reset_reactions_size |
Number of reset reactions allocated.
Indicates the size of the reset_reactions array.
| lf_scheduler_t* environment_t::scheduler |
Scheduler for managing worker threads.
Responsible for assigning reactions to worker threads and managing their execution.
| 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.
| int environment_t::shutdown_reactions_size |
Number of shutdown reactions allocated.
Indicates the size of the shutdown_reactions array.
| 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.
| tag_t environment_t::start_tag |
The start tag of the environment.
| 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.
| int environment_t::startup_reactions_size |
Number of startup reactions allocated.
Indicates the size of the startup_reactions array.
| 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.
| lf_thread_t* environment_t::thread_ids |
Array of worker thread IDs.
Stores the thread identifiers for all worker threads in this environment. Its length is num_workers; it is grown when worker threads are added with lf_add_worker_thread().
| 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.
| int environment_t::timer_triggers_size |
Number of timer triggers allocated.
Indicates the size of the timer_triggers array.
| watchdog_t** environment_t::watchdogs |
Array of watchdog timers.
Contains all watchdog timers associated with this environment for monitoring execution progress.
| int environment_t::watchdogs_size |
Number of watchdogs allocated.
Indicates the size of the watchdogs array.
| int environment_t::worker_thread_count |
Number of worker threads in this environment.
Indicates how many threads are available for parallel execution of reactions.