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

Threading fixes #145

Merged
merged 2 commits into from
Apr 14, 2019
Merged

Threading fixes #145

merged 2 commits into from
Apr 14, 2019

Conversation

s-ludwig
Copy link
Member

Fixes a race-condition reported by LDC's thread sanitizer, as well as implementing thread-safe task joining and interruption.

ThreadLocalWaiter.unused may only be accessed from the owner thread.
@s-ludwig s-ludwig requested a review from l-kramer April 13, 2019 15:14
- Task.join and Task.interrupt are now thread-safe
- TaskFiber.task returns Task.init if no task is running (avoids bogus resumes of the TaskFiber by the scheduler)

To enable thread-safe join/interrupt, the task counter is now stored together with the necessary flags within a single shared ulong that is manipulated atomically.
@l-kramer l-kramer merged commit 83a35ea into master Apr 14, 2019
@s-ludwig s-ludwig deleted the thread_fixes branch April 14, 2019 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants