2020-04-03 18:05:44 +02:00
|
|
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
esid: sec-atomics.waitasync
|
|
|
|
description: >
|
|
|
|
Test that Atomics.waitAsync times out with a negative timeout
|
2020-04-08 22:38:57 +02:00
|
|
|
info: |
|
|
|
|
Atomics.waitAsync( typedArray, index, value, timeout )
|
|
|
|
|
|
|
|
1. Return DoWait(async, typedArray, index, value, timeout).
|
|
|
|
|
|
|
|
DoWait ( mode, typedArray, index, value, timeout )
|
|
|
|
|
|
|
|
6. Let q be ? ToNumber(timeout).
|
|
|
|
|
2020-04-03 18:05:44 +02:00
|
|
|
flags: [async]
|
2020-05-27 21:11:06 +02:00
|
|
|
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics, destructuring-binding, arrow-function]
|
2020-04-03 18:05:44 +02:00
|
|
|
---*/
|
2020-06-12 18:57:14 +02:00
|
|
|
assert.sameValue(typeof Atomics.waitAsync, 'function');
|
2020-04-03 18:05:44 +02:00
|
|
|
const i32a = new Int32Array(
|
|
|
|
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
|
|
|
);
|
|
|
|
|
2020-04-07 21:39:15 +02:00
|
|
|
Promise.all([
|
|
|
|
Atomics.waitAsync(i32a, 0, 0, -1).value,
|
2020-04-15 22:55:47 +02:00
|
|
|
]).then(([outcome]) => {
|
2020-04-07 21:39:15 +02:00
|
|
|
assert.sameValue(
|
2020-04-15 22:55:47 +02:00
|
|
|
outcome,
|
2020-04-07 21:39:15 +02:00
|
|
|
'timed-out',
|
|
|
|
'Atomics.waitAsync(i32a, 0, 0, -1).value resolves to "timed-out"'
|
|
|
|
);
|
2020-06-24 21:46:37 +02:00
|
|
|
}).then($DONE, $DONE);
|