2017-02-07 17:17:31 +01:00
|
|
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
2017-07-26 23:49:55 +02:00
|
|
|
esid: sec-atomics.wake
|
2017-02-07 17:17:31 +01:00
|
|
|
description: >
|
|
|
|
Test that Atomics.wake wakes zero waiters if the count is NaN
|
2018-03-20 00:51:32 +01:00
|
|
|
features: [Atomics]
|
2017-02-07 17:17:31 +01:00
|
|
|
---*/
|
|
|
|
|
2017-03-02 18:00:16 +01:00
|
|
|
$262.agent.start(
|
2018-02-09 18:09:47 +01:00
|
|
|
`
|
2017-03-02 18:00:16 +01:00
|
|
|
$262.agent.receiveBroadcast(function (sab) {
|
2017-02-07 17:17:31 +01:00
|
|
|
var ia = new Int32Array(sab);
|
2017-03-02 18:00:16 +01:00
|
|
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
|
|
|
$262.agent.leaving();
|
2017-02-07 17:17:31 +01:00
|
|
|
})
|
|
|
|
`);
|
|
|
|
|
|
|
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
|
|
|
2017-03-02 18:00:16 +01:00
|
|
|
$262.agent.broadcast(ia.buffer);
|
2018-02-15 21:26:13 +01:00
|
|
|
$262.agent.sleep(500); // Give the agent a chance to wait
|
|
|
|
assert.sameValue(Atomics.wake(ia, 0, NaN), 0); // Don't actually wake it
|
2017-02-07 17:17:31 +01:00
|
|
|
assert.sameValue(getReport(), "timed-out");
|
|
|
|
|
|
|
|
function getReport() {
|
2018-02-15 21:26:13 +01:00
|
|
|
var r;
|
|
|
|
while ((r = $262.agent.getReport()) == null)
|
|
|
|
$262.agent.sleep(100);
|
|
|
|
return r;
|
2017-02-07 17:17:31 +01:00
|
|
|
}
|