[−][src]Function js_sys::Atomics::compare_exchange
pub fn compare_exchange(
typed_array: &JsValue,
index: u32,
expected_value: i32,
replacement_value: i32
) -> Result<i32, JsValue>
The static Atomics.compareExchange()
method exchanges a given
replacement value at a given position in the array, if a given expected
value equals the old value. It returns the old value at that position
whether it was equal to the expected value or not.
This atomic operation guarantees that no other write happens
until the modified value is written back.