mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-13 13:01:22 +00:00
added polyfill for Atomics.wait and used it to notify futures
This commit is contained in:
@ -495,6 +495,9 @@ extern "C" {
|
||||
pub fn slice_with_end(this: &SharedArrayBuffer, begin: u32, end: u32) -> SharedArrayBuffer;
|
||||
}
|
||||
|
||||
unsafe impl Send for SharedArrayBuffer {}
|
||||
unsafe impl Sync for SharedArrayBuffer {}
|
||||
|
||||
// Array Iterator
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
@ -598,10 +601,19 @@ pub mod Atomics {
|
||||
/// The static `Atomics.notify()` method notifies up some agents that
|
||||
/// are sleeping in the wait queue.
|
||||
/// Note: This operation works with a shared `Int32Array` only.
|
||||
/// If `count` is not provided, notifies all the agents int the queue.
|
||||
///
|
||||
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/notify)
|
||||
#[wasm_bindgen(js_namespace = Atomics, catch)]
|
||||
pub fn notify(typed_array: &Int32Array, index: u32, count: u32) -> Result<u32, JsValue>;
|
||||
pub fn notify(typed_array: &Int32Array, index: u32) -> Result<u32, JsValue>;
|
||||
|
||||
/// Notifies up to `count` agents in the wait queue.
|
||||
#[wasm_bindgen(js_namespace = Atomics, catch, js_name = notify)]
|
||||
pub fn notify_with_count(
|
||||
typed_array: &Int32Array,
|
||||
index: u32,
|
||||
count: u32,
|
||||
) -> Result<u32, JsValue>;
|
||||
|
||||
/// The static `Atomics.or()` method computes a bitwise OR with a given value
|
||||
/// at a given position in the array, and returns the old value at that position.
|
||||
|
Reference in New Issue
Block a user