-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
p_mutex_lock / p_mutex_trylock: race proofing.
Change up locking logic such that race conditions are less of a problem. in p_mutex_lock: spin until a lock is gotten *and* it equals 1 with two nested loops and atomic operations only. in p_mutex_trylock: fail early, but an atomic branch will cause a small check to see if a race happened *and* the thread asking for the mutex actually got the lock. No loops, only returns. Signed-off-by: Morgan Gangwere <[email protected]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
13 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