mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-23 00:16:17 +04:00
Merge branch 'OsTrain2018-g4' of github.com:oscourse-tsinghua/RustOS into lcy_issue1
This commit is contained in:
commit
2c3de7b222
@ -56,7 +56,13 @@ unsafe fn __atomic_compare_exchange<T: PartialEq>(dst: *mut T, expected: *mut T,
|
|||||||
let flags = interrupt::disable_and_store();
|
let flags = interrupt::disable_and_store();
|
||||||
let val = read(dst);
|
let val = read(dst);
|
||||||
let success = val == read(expected);
|
let success = val == read(expected);
|
||||||
write(dst, if success {desired} else {val});
|
if success {
|
||||||
|
write(dst, desired);
|
||||||
|
write(expected, val);
|
||||||
|
} else {
|
||||||
|
write(expected, val);
|
||||||
|
}
|
||||||
|
|
||||||
interrupt::restore(flags);
|
interrupt::restore(flags);
|
||||||
success
|
success
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user