rustc_data_structures: sync and atomic consistency
Co-authored-by: @lukas-code
This commit is contained in:
parent
64cfc21289
commit
52bd82f522
@ -139,14 +139,14 @@ cfg_if! {
|
|||||||
|
|
||||||
impl Atomic<bool> {
|
impl Atomic<bool> {
|
||||||
pub fn fetch_or(&self, val: bool, _: Ordering) -> bool {
|
pub fn fetch_or(&self, val: bool, _: Ordering) -> bool {
|
||||||
let result = self.0.get() | val;
|
let old = self.0.get();
|
||||||
self.0.set(val);
|
self.0.set(val | old);
|
||||||
result
|
old
|
||||||
}
|
}
|
||||||
pub fn fetch_and(&self, val: bool, _: Ordering) -> bool {
|
pub fn fetch_and(&self, val: bool, _: Ordering) -> bool {
|
||||||
let result = self.0.get() & val;
|
let old = self.0.get();
|
||||||
self.0.set(val);
|
self.0.set(val & old);
|
||||||
result
|
old
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user