-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix data races in n_avail(::Channel) to fix isready/isempty
This removes the data race from isready() and isempty(), which are now implemented in terms of n_avail(). A new atomic `n_avail` field is added to track the "current number of available items" (buffered + waiting tasks). This is separate from the buffer and wait queue because these consist of `Vector`s which cannot easily have their length fields read and written atomically. For buffered channels, the n_avail now includes a count of any waiting tasks in addition to the number of buffered items. This makes it consistent with the computation for unbuffered channels. Co-authored-by: Takafumi Arakaki <[email protected]>
- Loading branch information
Showing
3 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters