fixup! Atomics.waitAsync: no spurious wakeup on [operation]

This commit is contained in:
Rick Waldron 2020-04-08 16:02:24 -04:00
parent e9ee3dcd62
commit f03c0c2de3
9 changed files with 189 additions and 171 deletions

View File

@ -22,6 +22,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -34,38 +35,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield();
// NO OPERATION OCCURS HERE! Atomics.add(i32a, 0, 1);
assert.sameValue(agentCount, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -21,6 +21,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -33,38 +34,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.add(i32a, 0, 1); Atomics.add(i32a, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -21,6 +21,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -33,38 +34,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.and(i32a, 0, 1); Atomics.and(i32a, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -21,6 +21,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -33,38 +34,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.compareExchange(i32a, 0, 0, 1); Atomics.compareExchange(i32a, 0, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -21,6 +21,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -33,38 +34,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.exchange(i32a, 0, 1); Atomics.exchange(i32a, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -21,6 +21,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -33,38 +34,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.or(i32a, 0, 1); Atomics.or(i32a, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -21,6 +21,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -33,38 +34,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield();
Atomics.store(i32a, 0, 0x111111); assert.sameValue(agentCount, 1);
Atomics.store(i32a, 0, 0b1010);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -22,6 +22,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -34,38 +35,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.sub(i32a, 0, 1); Atomics.sub(i32a, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);

View File

@ -22,6 +22,7 @@ info: |
c. Perform NotifyWaiter(WL, waiterRecord). c. Perform NotifyWaiter(WL, waiterRecord).
4. Perform LeaveCriticalSection(WL). 4. Perform LeaveCriticalSection(WL).
flags: [async]
includes: [atomicsHelper.js] includes: [atomicsHelper.js]
features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics] features: [Atomics.waitAsync, SharedArrayBuffer, TypedArray, Atomics]
---*/ ---*/
@ -34,38 +35,39 @@ const i32a = new Int32Array(
); );
$262.agent.start(` $262.agent.start(`
$262.agent.receiveBroadcast(async function(sab) => { $262.agent.receiveBroadcast(async (sab) => {
const i32a = new Int32Array(sab); const i32a = new Int32Array(sab);
Atomics.add(i32a, ${RUNNING}, 1); Atomics.add(i32a, ${RUNNING}, 1);
const before = $262.agent.monotonicNow(); const before = $262.agent.monotonicNow();
const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value; const unpark = await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value;
const duration = $262.agent.monotonicNow() - before; const duration = $262.agent.monotonicNow() - before;
$262.agent.report(duration); $262.agent.report(duration);
$262.agent.report(unpark); $262.agent.report(unpark);
$262.agent.leaving(); $262.agent.leaving();
}); });
`); `);
$262.agent.safeBroadcast(i32a); $262.agent.safeBroadcastAsync(i32a, RUNNING, 1).then(async (agentCount) => {
$262.agent.waitUntil(i32a, RUNNING, 1);
$262.agent.tryYield(); assert.sameValue(agentCount, 1);
Atomics.xor(i32a, 0, 1); Atomics.xor(i32a, 0, 1);
const lapse = await $262.agent.getReportAsync();
assert( assert(
$262.agent.getReport() >= TIMEOUT, lapse >= TIMEOUT,
'The result of `(lapse >= TIMEOUT)` is true' 'The result of `(lapse >= TIMEOUT)` is true'
); );
assert.sameValue( const result = await $262.agent.getReportAsync();
$262.agent.getReport(),
'timed-out',
'await Atomics.wait(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
);
assert.sameValue( assert.sameValue(
Atomics.notify(i32a, 0), result,
0, 'timed-out',
'Atomics.notify(i32a, 0) returns 0' 'await Atomics.waitAsync(i32a, 0, 0, ${TIMEOUT}).value resolves to "timed-out"'
); );
assert.sameValue(Atomics.notify(i32a, 0), 0, 'Atomics.notify(i32a, 0) returns 0');
}).then($DONE, $DONE);