Migrate standard library away from compare_and_swap
This commit is contained in:
parent
4252e48256
commit
828d4ace4d
15 changed files with 79 additions and 36 deletions
|
|
@ -123,9 +123,9 @@ impl Mutex {
|
|||
let inner = box Inner { remutex: ReentrantMutex::uninitialized(), held: Cell::new(false) };
|
||||
inner.remutex.init();
|
||||
let inner = Box::into_raw(inner);
|
||||
match self.lock.compare_and_swap(0, inner as usize, Ordering::SeqCst) {
|
||||
0 => inner,
|
||||
n => {
|
||||
match self.lock.compare_exchange(0, inner as usize, Ordering::SeqCst, Ordering::SeqCst) {
|
||||
Ok(_) => inner,
|
||||
Err(n) => {
|
||||
Box::from_raw(inner).remutex.destroy();
|
||||
n as *const _
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue