js_sys::Atomics

Function compare_exchange_bigint

Source
pub fn compare_exchange_bigint(
    typed_array: &JsValue,
    index: u32,
    expected_value: i64,
    replacement_value: i64,
) -> Result<i64, JsValue>
Expand description

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.

This method is used to operate on a BigInt64Array or a BigUint64Array.

MDN documentation