rustc_metadata: use configurable AtomicBool for privateness flag
This switches to using a `Cell` for single-threaded rustc.
This commit is contained in:
parent
b537c1f175
commit
a12f50ddc4
2 changed files with 16 additions and 2 deletions
|
@ -143,6 +143,20 @@ cfg_if! {
|
|||
self.0.set(val);
|
||||
result
|
||||
}
|
||||
pub fn fetch_update(
|
||||
&self,
|
||||
_order_set: Ordering,
|
||||
_order_get: Ordering,
|
||||
mut f: impl FnMut(bool) -> Option<bool>,
|
||||
) -> Result<bool, bool> {
|
||||
let prev = self.0.get();
|
||||
if let Some(next) = f(prev) {
|
||||
self.0.set(next);
|
||||
Ok(prev)
|
||||
} else {
|
||||
Err(prev)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Copy + PartialEq> Atomic<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue