-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change atomic memory access semantics
* The explanation at [0] and in that article's comments is sufficiently convincing to downgrade from `memory_order_release` to `memory_order_relaxed` when acquiring a lock (i.e. when setting the event to false). * We explicitly handle any concurrent calls to `ResetEvent()` as racy by nature and don't waste time trying to obtain the mutex. * All `RefCount` manipulations have been downgraded from the default `memory_order_seq_cst` to an explicit `memory_order_acq_rel` given their access patterns. * Back-to-back changes to `event->State` during processing have been replaced with explicit values at the distinct call branches to avoid any cache line issues. [0]: https://preshing.com/20170612/can-reordering-of-release-acquire-operations-introduce-deadlock/
- Loading branch information
Showing
1 changed file
with
98 additions
and
68 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