Atomics.waitAsync: false for timeouts, revised.

This commit is contained in:
Rick Waldron 2020-04-03 12:02:30 -04:00
parent 9519cd8448
commit 677fb82a75
2 changed files with 13 additions and 26 deletions

View File

@ -36,9 +36,9 @@ $262.agent.start(`
const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1);
const status1 = await Atomics.waitAsync(i32a, 0, 0, false);
const status2 = await Atomics.waitAsync(i32a, 0, 0, valueOf);
const status3 = await Atomics.waitAsync(i32a, 0, 0, toPrimitive);
const status1 = await Atomics.waitAsync(i32a, 0, 0, false).value;
const status2 = await Atomics.waitAsync(i32a, 0, 0, valueOf).value;
const status3 = await Atomics.waitAsync(i32a, 0, 0, toPrimitive).value;
$262.agent.report(status1);
$262.agent.report(status2);

View File

@ -14,7 +14,7 @@ info: |
6. Let q be ? ToNumber(timeout).
flags: [async, CanBlockIsTrue]
flags: [async]
includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/
@ -34,25 +34,12 @@ const toPrimitive = {
}
};
(async () => {
try {
assert.sameValue(
await Atomics.waitAsync(i32a, 0, 0, false),
'timed-out',
'Atomics.waitAsync(i32a, 0, 0, false) returns "timed-out"'
);
assert.sameValue(
await Atomics.waitAsync(i32a, 0, 0, valueOf),
'timed-out',
'Atomics.waitAsync(i32a, 0, 0, valueOf) returns "timed-out"'
);
assert.sameValue(
await Atomics.waitAsync(i32a, 0, 0, toPrimitive),
'timed-out',
'Atomics.waitAsync(i32a, 0, 0, toPrimitive) returns "timed-out"'
);
$DONE();
} catch (error) {
$DONE(error);
}
})();
Promise.all([
Atomics.waitAsync(i32a, 0, 0, false).value,
Atomics.waitAsync(i32a, 0, 0, valueOf).value,
Atomics.waitAsync(i32a, 0, 0, toPrimitive).value,
]).then(outcomes => {
assert.sameValue(outcomes[0], "timed-out");
assert.sameValue(outcomes[0], "timed-out");
assert.sameValue(outcomes[0], "timed-out");
}, $DONE).then($DONE, $DONE);