33#define SUPPRESS_UNUSED_WARNING(x) (void)(x)
90#ifdef FEDERATED_DECENTRALIZED
238#if !defined(LF_SINGLE_THREADED)
A higher level API to the clock utilities provided by the platform API.
#define lf_added_worker_thread_count()
Return the number of worker threads that have been added to the environment invoking this reaction.
Definition reaction_macros.h:228
#define lf_reactor_name(reactor)
Return the instance name of the reactor.
Definition reaction_macros.h:358
#define lf_set_present(out)
Mark a port present.
Definition reaction_macros.h:48
#define lf_add_worker_thread()
Add a worker thread to the pool of worker threads of the environment invoking this reaction.
Definition reaction_macros.h:220
#define lf_reactor_full_name(reactor)
Return the fully qualified name of the reactor.
Definition reaction_macros.h:370
void lf_request_stop(void)
Request a stop to execution as soon as possible.
void lf_async_resume(void *action)
Resume a reaction suspended in lf_async() that is waiting on the specified action.
bool lf_is_tag_after_stop_tag(environment_t *env, tag_t tag)
Return true if the provided tag is after stop tag.
int64_t interval_t
Interval of time.
Definition tag.h:107
void lf_set_federation_id(const char *fid)
Set the federation ID of this federate.
bool lf_rti_has_failed(void)
Return true if the RTI has reported failure.
void lf_set_fed_maxwait(interval_t offset)
Set the global maxwait for the current federate.
const char * lf_get_federation_id()
Return the federation ID.
interval_t lf_get_fed_maxwait(void)
Return the global maxwait for the current federate.
void lf_set_sta(interval_t offset)
Set the global STA (safe to advance) offset for federated execution.
interval_t lf_get_sta(void)
Return the global STA (safe to advance) offset for federated execution.
void lf_set_stop_tag(environment_t *env, tag_t tag)
Set the stop tag if it is less than the stop tag of the specified environment.
void _lf_await(void *self, void *port)
Suspend the calling reaction until another reaction of the same reactor calls lf_await_resume() on th...
self_base_t * lf_new_reactor(size_t size)
Allocate memory for a new runtime instance of a reactor.
void * lf_allocate(size_t count, size_t size, struct allocation_record_t **head)
Allocate memory and record on the specified allocation record (a self struct).
void lf_free_reactor(self_base_t *self)
Free the specified reactor.
void _lf_async_end(lf_async_state_t *state)
Complete a call prepared by _lf_async_begin().
void lf_print_snapshot(environment_t *env)
Print a snapshot of the priority queues used during execution (for debugging).
void _lf_async_begin(lf_async_state_t *state, void *self, void *action, void *port)
Prepare to invoke a possibly blocking function from a reaction without blocking the environment.
void _lf_await_resume(void *self, void *port)
Resume every reaction of this reactor that is suspended in lf_await() on the specified port.
void lf_free_all_reactors(void)
Free all the reactors that are allocated with lf_new_reactor(size_t).
Type definitions that are widely used across different parts of the runtime.
Header file of the runtime infrastructure for modes in the C target of Lingua Franca.
Support for optimizing sparse input through multiports.
void lf_set_stp_offset(interval_t offset)
Set the global STP offset on advancement of logical time for federated execution.
interval_t lf_get_stp_offset(void)
Return the global STP offset on advancement of logical time for federated execution.
Allocation record to keep track of dynamically-allocated memory.
Definition lf_types.h:499
Execution environment.
Definition environment.h:66
Base type for actions.
Definition lf_types.h:583
State of a pending lf_async() call.
Definition reactor.h:203
bool resumed
Set to true when the call has been resumed.
Definition reactor.h:216
lf_cond_t resumed_cond
Signaled when resumed becomes true.
Definition reactor.h:240
bool left_pool
True if the calling thread left the pool of worker threads.
Definition reactor.h:225
self_base_t * self
The reactor whose reaction invoked lf_async().
Definition reactor.h:205
bool resume_waiting
Set to true by lf_async_resume() when it is waiting for function_done.
Definition reactor.h:220
struct lf_async_state_t * next
Next pending call in the environment, or NULL.
Definition reactor.h:237
bool event_pending
True if this call scheduled the logical action for resume_tag.
Definition reactor.h:235
lf_action_base_t * action
The action that resumes this call, or NULL for lf_await(), which is resumed by lf_await_resume().
Definition reactor.h:212
bool function_done
Set to true in _lf_async_end(), once the invoked function has returned.
Definition reactor.h:218
lf_port_base_t * port
The input port passed to lf_await(), or NULL for lf_async().
Definition reactor.h:214
tag_t resume_tag
Tag at which a logical action resumes this call.
Definition reactor.h:230
reaction_t * reaction
The reaction that invoked lf_async().
Definition reactor.h:207
Base type for ports.
Definition lf_token.h:202
Reaction activation record to push onto the reaction queue.
Definition lf_types.h:195
The base type for all reactor self structs.
Definition lf_types.h:519
A tag is a time, microstep pair.
Definition tag.h:119
Time and tag definitions and functions for Lingua Franca.
Definitions of tracepoint functions for use with the C code generator and any other code generator th...
Core utility functions for Lingua Franca.