First renaming for wake to notify in the wait folder

This commit is contained in:
Leo Balter 2018-06-28 16:24:50 -04:00 committed by Rick Waldron
parent 4911c6e77a
commit d8bbc281dd
38 changed files with 82 additions and 77 deletions

View File

@ -39,5 +39,5 @@ $262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait. // Try to yield control to ensure the agent actually started to wait.
$262.agent.tryYield(); $262.agent.tryYield();
assert.sameValue(Atomics.wake(i64a, 0), 1, 'Atomics.wake(i64a, 0) returns 1'); assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1');
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');

View File

@ -36,4 +36,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -56,4 +56,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Add operation Waiter does not spuriously notify on index which is subject to Add operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,6 +49,6 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to And operation Waiter does not spuriously nofity on index which is subject to And operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,6 +49,6 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to compareExchange operation Waiter does not spuriously notify on index which is subject to compareExchange operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to exchange operation Waiter does not spuriously notify on index which is subject to exchange operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,9 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
<<<<<<< HEAD
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0');
=======
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
>>>>>>> e6e13b293e... First renaming for wake to notify in the wait folder

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Or operation Waiter does not spuriously notify on index which is subject to Or operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Sub operation Waiter does not spuriously notify on index which is subject to Sub operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to xor operation Waiter does not spuriously notify on index which is subject to xor operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray] features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0'); assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');

View File

@ -56,20 +56,20 @@ $262.agent.broadcast(i64a.buffer);
// Wait until all agents started. // Wait until all agents started.
$262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT)); $262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT));
// Wake index 1, wakes nothing // Notify index 1, notifies nothing
assert.sameValue(Atomics.wake(i64a, 1), 0, 'Atomics.wake(i64a, 1) returns 0'); assert.sameValue(Atomics.notify(i64a, 1), 0, 'Atomics.notify(i64a, 1) returns 0');
// Wake index 3, wakes nothing // Notify index 3, notifies nothing
assert.sameValue(Atomics.wake(i64a, 3), 0, 'Atomics.wake(i64a, 3) returns 0'); assert.sameValue(Atomics.notify(i64a, 3), 0, 'Atomics.notify(i64a, 3) returns 0');
// Wake index 2, wakes 1 // Notify index 2, notifies 1
var woken = 0; var woken = 0;
while ((woken = Atomics.wake(i64a, 2)) === 0) ; while ((woken = Atomics.notify(i64a, 2)) === 0) ;
assert.sameValue(woken, 1, 'Atomics.wake(i64a, 2) returns 1'); assert.sameValue(woken, 1, 'Atomics.notify(i64a, 2) returns 1');
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');
// Wake index 0, wakes 1 // Notify index 0, notifies 1
var woken = 0; var woken = 0;
while ((woken = Atomics.wake(i64a, 0)) === 0) ; while ((woken = Atomics.notify(i64a, 0)) === 0) ;
assert.sameValue(woken, 1, 'Atomics.wake(i64a, 0) returns 1'); assert.sameValue(woken, 1, 'Atomics.notify(i64a, 0) returns 1');
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');

View File

@ -77,13 +77,13 @@ for (var i = 0; i < NUMAGENT; i++) {
Atomics.store(i64a, LOCK_INDEX, 0n); Atomics.store(i64a, LOCK_INDEX, 0n);
} }
// Agents must wake in the order they waited. // Agents must notify in the order they waited.
for (var i = 0; i < NUMAGENT; i++) { for (var i = 0; i < NUMAGENT; i++) {
var woken = 0; var woken = 0;
while ((woken = Atomics.wake(i64a, WAIT_INDEX, 1)) === 0) ; while ((woken = Atomics.notify(i64a, WAIT_INDEX, 1)) === 0) ;
assert.sameValue(woken, 1, assert.sameValue(woken, 1,
'Atomics.wake(i64a, WAIT_INDEX, 1) returns 1, at index = ' + i); 'Atomics.notify(i64a, WAIT_INDEX, 1) returns 1, at index = ' + i);
assert.sameValue($262.agent.getReport(), 'ok', assert.sameValue($262.agent.getReport(), 'ok',
'$262.agent.getReport() returns "ok", at index = ' + i); '$262.agent.getReport() returns "ok", at index = ' + i);

View File

@ -50,7 +50,7 @@ $262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait. // Try to yield control to ensure the agent actually started to wait.
$262.agent.tryYield(); $262.agent.tryYield();
assert.sameValue(Atomics.wake(i64a, 0), 1, 'Atomics.wake(i64a, 0) returns 1'); assert.sameValue(Atomics.notify(i64a, 0), 1, 'Atomics.notify(i64a, 0) returns 1');
const lapse = $262.agent.getReport(); const lapse = $262.agent.getReport();

View File

@ -81,4 +81,4 @@ assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a mi
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -39,5 +39,5 @@ $262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait. // Try to yield control to ensure the agent actually started to wait.
$262.agent.tryYield(); $262.agent.tryYield();
assert.sameValue(Atomics.wake(i32a, 0), 1, 'Atomics.wake(i32a, 0) returns 1'); assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1');
assert.sameValue($262.agent.getReport(), "ok", '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), "ok", '$262.agent.getReport() returns "ok"');

View File

@ -36,4 +36,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Add operation Waiter does not spuriously notify on index which is subject to Add operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to And operation Waiter does not spuriously notify on index which is subject to And operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to compareExchange operation Waiter does not spuriously notify on index which is subject to compareExchange operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to exchange operation Waiter does not spuriously notify on index which is subject to exchange operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Or operation Waiter does not spuriously notify on index which is subject to Or operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Store operation Waiter does not spuriously notify on index which is subject to Store operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to Sub operation Waiter does not spuriously notify on index which is subject to Sub operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -4,7 +4,7 @@
/*--- /*---
esid: sec-atomics.wait esid: sec-atomics.wait
description: > description: >
Waiter does not spuriously wake on index which is subject to xor operation Waiter does not spuriously notify on index which is subject to xor operation
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray] features: [Atomics, SharedArrayBuffer, TypedArray]
---*/ ---*/
@ -49,4 +49,4 @@ assert.sameValue(
'timed-out', 'timed-out',
'$262.agent.getReport() returns "timed-out"' '$262.agent.getReport() returns "timed-out"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -81,4 +81,4 @@ assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a mi
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $262.agent.MAX_TIME_EPSILON)'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -87,4 +87,4 @@ assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a mi
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -85,4 +85,4 @@ assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a mi
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -97,4 +97,4 @@ const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (The result of `(lapse >= 0)` is true (timeout should be a min of 0ms))'); assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (The result of `(lapse >= 0)` is true (timeout should be a min of 0ms))');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON))'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON))');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -72,4 +72,4 @@ const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)'); assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -88,4 +88,4 @@ const lapse = $262.agent.getReport();
assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)'); assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a min of 0ms)');
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -81,4 +81,4 @@ assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a mi
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)'); assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true (timeout should be a max of $$262.agent.MAX_TIME_EPSILON)');
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -20,7 +20,7 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
const WAIT_INDEX = 0; // Index all agents are waiting on const WAIT_INDEX = 0; // Index all agents are waiting on
const RUNNING = 1; const RUNNING = 1;
const NUMAGENT = 2; // Total number of agents started const NUMAGENT = 2; // Total number of agents started
const WAKECOUNT = 2; // Total number of agents to wake up const WAKECOUNT = 2; // Total number of agents to notify up
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(function(sab) { $262.agent.receiveBroadcast(function(sab) {
@ -55,9 +55,9 @@ $262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
$262.agent.tryYield(); $262.agent.tryYield();
assert.sameValue( assert.sameValue(
Atomics.wake(i32a, WAIT_INDEX, WAKECOUNT), Atomics.notify(i32a, WAIT_INDEX, WAKECOUNT),
WAKECOUNT, WAKECOUNT,
'Atomics.wake(i32a, WAIT_INDEX, WAKECOUNT) returns the value of `WAKECOUNT` (2)' 'Atomics.notify(i32a, WAIT_INDEX, WAKECOUNT) returns the value of `WAKECOUNT` (2)'
); );
const reports = []; const reports = [];

View File

@ -45,6 +45,6 @@ $262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait. // Try to yield control to ensure the agent actually started to wait.
$262.agent.tryYield(); $262.agent.tryYield();
assert.sameValue(Atomics.wake(i32a, 0), 1, 'Atomics.wake(i32a, 0) returns 1'); // wake at index 0 assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1'); // notify at index 0
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); // wake again at index 0, and 0 agents should be woken assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0'); // notify again at index 0, and 0 agents should be woken
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');

View File

@ -54,4 +54,4 @@ assert.sameValue(
'not-equal', 'not-equal',
'$262.agent.getReport() returns "not-equal"' '$262.agent.getReport() returns "not-equal"'
); );
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0'); assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');

View File

@ -56,20 +56,20 @@ $262.agent.broadcast(i32a.buffer);
// Wait until all agents started. // Wait until all agents started.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT); $262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
// Wake index 1, wakes nothing // Wake index 1, notifies nothing
assert.sameValue(Atomics.wake(i32a, 1), 0, 'Atomics.wake(i32a, 1) returns 0'); assert.sameValue(Atomics.notify(i32a, 1), 0, 'Atomics.notify(i32a, 1) returns 0');
// Wake index 3, wakes nothing // Wake index 3, notifies nothing
assert.sameValue(Atomics.wake(i32a, 3), 0, 'Atomics.wake(i32a, 3) returns 0'); assert.sameValue(Atomics.notify(i32a, 3), 0, 'Atomics.notify(i32a, 3) returns 0');
// Wake index 2, wakes 1 // Wake index 2, notifies 1
var woken = 0; var woken = 0;
while ((woken = Atomics.wake(i32a, 2)) === 0) ; while ((woken = Atomics.notify(i32a, 2)) === 0) ;
assert.sameValue(woken, 1, 'Atomics.wake(i32a, 2) returns 1'); assert.sameValue(woken, 1, 'Atomics.notify(i32a, 2) returns 1');
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');
// Wake index 0, wakes 1 // Wake index 0, notifies 1
var woken = 0; var woken = 0;
while ((woken = Atomics.wake(i32a, 0)) === 0) ; while ((woken = Atomics.notify(i32a, 0)) === 0) ;
assert.sameValue(woken, 1, 'Atomics.wake(i32a, 0) returns 1'); assert.sameValue(woken, 1, 'Atomics.notify(i32a, 0) returns 1');
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"'); assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');

View File

@ -77,13 +77,13 @@ for (var i = 0; i < NUMAGENT; i++) {
Atomics.store(i32a, LOCK_INDEX, 0); Atomics.store(i32a, LOCK_INDEX, 0);
} }
// Agents must wake in the order they waited. // Agents must notify in the order they waited.
for (var i = 0; i < NUMAGENT; i++) { for (var i = 0; i < NUMAGENT; i++) {
var woken = 0; var woken = 0;
while ((woken = Atomics.wake(i32a, WAIT_INDEX, 1)) === 0) ; while ((woken = Atomics.notify(i32a, WAIT_INDEX, 1)) === 0) ;
assert.sameValue(woken, 1, assert.sameValue(woken, 1,
'Atomics.wake(i32a, WAIT_INDEX, 1) returns 1, at index = ' + i); 'Atomics.notify(i32a, WAIT_INDEX, 1) returns 1, at index = ' + i);
assert.sameValue($262.agent.getReport(), 'ok', assert.sameValue($262.agent.getReport(), 'ok',
'$262.agent.getReport() returns "ok", at index = ' + i); '$262.agent.getReport() returns "ok", at index = ' + i);

View File

@ -50,7 +50,7 @@ $262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait. // Try to yield control to ensure the agent actually started to wait.
$262.agent.tryYield(); $262.agent.tryYield();
assert.sameValue(Atomics.wake(i32a, 0), 1, 'Atomics.wake(i32a, 0) returns 1'); assert.sameValue(Atomics.notify(i32a, 0), 1, 'Atomics.notify(i32a, 0) returns 1');
const lapse = $262.agent.getReport(); const lapse = $262.agent.getReport();