Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bindings and comments for Atomics.wait #3509

Merged
merged 2 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
because required arguments occurring after optional arguments are currently not supported by the generator.
[#3480](https://github.com/rustwasm/wasm-bindgen/pull/3480)

### Fixed

* Fixed bindings and comments for `Atomics.wait`.
[#3509](https://github.com/rustwasm/wasm-bindgen/pull/3509)

## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87)

Released 2023-06-12.
Expand Down
16 changes: 8 additions & 8 deletions crates/js-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,32 +1148,32 @@ pub mod Atomics {
/// Note: This operation only works with a shared `Int32Array`
/// and may not be allowed on the main thread.
///
/// You should use `wait_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`.
/// You should use `wait_bigint` to operate on a `BigInt64Array`.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait)
#[wasm_bindgen(js_namespace = Atomics, catch)]
pub fn wait(typed_array: &Int32Array, index: u32, value: i32) -> Result<JsString, JsValue>;

/// The static `Atomics.wait()` method verifies that a given
/// position in an `Int32Array` still contains a given value
/// position in an `BigInt64Array` still contains a given value
/// and if so sleeps, awaiting a wakeup or a timeout.
/// It returns a string which is either "ok", "not-equal", or "timed-out".
/// Note: This operation only works with a shared `Int32Array`
/// Note: This operation only works with a shared `BigInt64Array`
/// and may not be allowed on the main thread.
///
/// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`.
/// You should use `wait` to operate on a `Int32Array`.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait)
#[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)]
pub fn wait_bigint(
typed_array: &Int32Array,
typed_array: &BigInt64Array,
index: u32,
value: i64,
) -> Result<JsString, JsValue>;

/// Like `wait()`, but with timeout
///
/// You should use `wait_with_timeout_bigint` to operate on a `BigInt64Array` or a `BigUint64Array`.
/// You should use `wait_with_timeout_bigint` to operate on a `BigInt64Array`.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait)
#[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)]
Expand All @@ -1186,12 +1186,12 @@ pub mod Atomics {

/// Like `wait()`, but with timeout
///
/// This method is used to operate on a `BigInt64Array` or a `BigUint64Array`.
/// You should use `wait_with_timeout` to operate on a `Int32Array`.
///
/// [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait)
#[wasm_bindgen(js_namespace = Atomics, catch, js_name = wait)]
pub fn wait_with_timeout_bigint(
typed_array: &Int32Array,
typed_array: &BigInt64Array,
index: u32,
value: i64,
timeout: f64,
Expand Down