blob: a4e8868ade4ad2f11d0e45d4b82d8128bc667acb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-atomics.wake
description: >
Test that Atomics.wake wakes zero waiters if the count is NaN
---*/
$262.agent.start(
`
$262.agent.receiveBroadcast(function (sab) {
var ia = new Int32Array(sab);
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
$262.agent.leaving();
})
`);
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
$262.agent.broadcast(ia.buffer);
$262.agent.sleep(500); // Give the agent a chance to wait
assert.sameValue(Atomics.wake(ia, 0, NaN), 0); // Don't actually wake it
assert.sameValue(getReport(), "timed-out");
function getReport() {
var r;
while ((r = $262.agent.getReport()) == null)
$262.agent.sleep(100);
return r;
}
|