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

Actions remain "present" after they're scheduled for the first time (C-Target) #2291

Closed
AneesHl opened this issue May 21, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working c Related to C target
Milestone

Comments

@AneesHl
Copy link

AneesHl commented May 21, 2024

In the C-Target, once an action is scheduled for the first time then action_id->is_present always returns true. As an example, the following program

target C { timeout: 1 sec, keepalive: true }

main reactor {
  state ms_250 : time = 250 msec
  logical action _logical
  physical action _physical : float
  timer t(0 msec, 250 msec);

  reaction(startup) -> _logical, _physical {=
    printf("\n--- Startup Reaction ---\n");
    
    lf_schedule(_logical, self->ms_250);
    lf_schedule(_physical, self->ms_250 * 2);
  =}
  
  reaction(_logical, _physical, t) {=
    printf("\n--- Reaction 2 ---\n");
    
    if (_logical->is_present) {
      printf("_logical->is_present = true\n");
    }
    if (_physical->is_present) {
      printf("_physical->is_present = true\n");
    }
    
    printf("~> elapsed logical time  = " PRINTF_TIME "\n", lf_time_logical_elapsed());
  =}
}

it produces the following result:

...
--- Startup Reaction ---

--- Reaction 2 ---
~> elapsed logical time  = 0

--- Reaction 2 ---
_logical->is_present = true
~> elapsed logical time  = 250000000

--- Reaction 2 ---
_logical->is_present = true
~> elapsed logical time  = 500000000

--- Reaction 2 ---
_logical->is_present = true
_physical->is_present = true
~> elapsed logical time  = 500410000

--- Reaction 2 ---
_logical->is_present = true
_physical->is_present = true
~> elapsed logical time  = 750000000

--- Reaction 2 ---
_logical->is_present = true
_physical->is_present = true
~> elapsed logical time  = 1000000000
...
@lhstrh
Copy link
Member

lhstrh commented Sep 29, 2024

Fixed via #2409.

@lhstrh lhstrh closed this as completed Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c Related to C target
Projects
None yet
Development

No branches or pull requests

5 participants