Conditionally replaces the value in the atomic integer by a new one with relaxed ordering guarantees.
impl AtomicUsize {
fn compare_exchange_weak(&self, old: usize, new: usize) -> usize
}| Name | Description |
|---|---|
| old | The value the atomic integer is compared to. |
| new | The value to be stored in the atomic integer. |
Returns the value previously stored in the atomic integer.
If the returned value is the same as old, the value in the atomic integer has been replaced by new.