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

Fix race condtions related to the scheduling of physical actions #31

Merged
merged 5 commits into from
Oct 18, 2022

Conversation

cmnrd
Copy link
Contributor

@cmnrd cmnrd commented Oct 14, 2022

This change fixes to race conditions

  1. Before this change, it could happen that a physical action determines its next tag, but then the scheduler already advances beyond this tag before the new event is inserted in the event queue. In other words, determining the tag and inserting the event at this tag was not an atomic operation. This change includes the determining of the tag in schedule_async while the lock is held and hence makes scheduling physical actions an atomic operation.
  2. There was a race condition on the internal event list kept by an action (events_) between scheduling the physical action and setting it up from the scheduler. This was fixed by acquiring the mutex also in setup().

Before this change, it could happen that a physical action already determines
its next tag, but then the scheduler already advances beyond this tag before the
new event is inserted in the event queue. In other words, determining the tag
and inserting the event at this tag was not an atomic operation.

This change includes the determining of the tag in `schedule_async` while the
lock is held and hence makes scheduling physical actions an atomic operation.
@cmnrd cmnrd changed the title Fix race condition between the scheduler and physical actions Fix race condtions related to the scheduling of physical actions Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant