Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MTGS: use acquire/release semantics for atomic operation
* Avoid the generation of memory barrier (mfence) * Based on the fact that it used to work on previous code without any barrier v2: * keep "slow" and safe atomic on reset path * use relaxed atomic for m_RingBufferIsBusy The signal doesn't carry dependency with others load/store. Instead it is used as an hint to awake the semaphore As a side, there is a potential thread bug T1 do * wait sema * busy = true; * while (!queue.empty) do work... * busy = false; * go back to wait sema T2 do * post sema even if busy is false If T1 stop after the while queue but before the busy, T2 won't post the event. When T1 will wake up, it will block on the semaphore
- Loading branch information
Showing
1 changed file
with
18 additions
and
18 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