Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against unconnected outputs #275

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/reactor.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ extern instant_t start_time;

/**
* Mark the given port's is_present field as true. This is_present field
* will later be cleaned up by _lf_start_time_step.
* will later be cleaned up by _lf_start_time_step. If the port is unconnected,
* do nothing.
* @param env Environment in which we are executing
* @param port A pointer to the port struct.
*/
void _lf_set_present(lf_port_base_t* port) {
environment_t *env = port->source_reactor->environment;
if (!port->source_reactor) return;
environment_t *env = port->source_reactor->environment;
bool* is_present_field = &port->is_present;
if (env->is_present_fields_abbreviated_size < env->is_present_fields_size) {
env->is_present_fields_abbreviated[env->is_present_fields_abbreviated_size]
Expand Down
6 changes: 4 additions & 2 deletions core/threaded/reactor_threaded.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ int _lf_wait_on_tag_barrier(environment_t* env, tag_t proposed_tag) {

/**
* Mark the given port's is_present field as true. This is_present field
* will later be cleaned up by _lf_start_time_step.
* will later be cleaned up by _lf_start_time_step. If the port is unconnected,
* do nothing.
* This assumes that the mutex is not held.
* @param port A pointer to the port struct.
*/
void _lf_set_present(lf_port_base_t* port) {
environment_t *env = port->source_reactor->environment;
if (!port->source_reactor) return;
environment_t *env = port->source_reactor->environment;
bool* is_present_field = &port->is_present;
int ipfas = lf_atomic_fetch_add(&env->is_present_fields_abbreviated_size, 1);
if (ipfas < env->is_present_fields_size) {
Expand Down
Loading