mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
Add Atomics.notify instead of Atomics.wake according to revised spec.
- Keep .wake as an alias until we're certain it can be removed. - Enable SAB memory
This commit is contained in:
parent
c3a85ded77
commit
f5923f0626
5 changed files with 30 additions and 34 deletions
|
|
@ -67,6 +67,8 @@ if (helperThreadCount() === 0) {
|
|||
quit();
|
||||
}
|
||||
|
||||
var mem = new Int32Array(new SharedArrayBuffer(1024));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// wait() returns "not-equal" if the value is not the expected one.
|
||||
|
|
@ -102,7 +104,7 @@ dprint("Sleeping for 2 seconds");
|
|||
sleep(2);
|
||||
dprint("Waking the main thread now");
|
||||
setSharedArrayBuffer(null);
|
||||
assertEq(Atomics.wake(mem, 0, 1), 1); // Can fail spuriously but very unlikely
|
||||
assertEq(Atomics.notify(mem, 0, 1), 1); // Can fail spuriously but very unlikely
|
||||
`);
|
||||
|
||||
var then = Date.now();
|
||||
|
|
@ -113,14 +115,14 @@ assertEq(getSharedArrayBuffer(), null); // The worker's clearing of the mbx is v
|
|||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// Test the default argument to atomics.wake()
|
||||
// Test the default argument to atomics.notify()
|
||||
|
||||
setSharedArrayBuffer(mem.buffer);
|
||||
|
||||
evalInWorker(`
|
||||
var mem = new Int32Array(getSharedArrayBuffer());
|
||||
sleep(2); // Probably long enough to avoid a spurious error next
|
||||
assertEq(Atomics.wake(mem, 0), 1); // Last argument to wake should default to +Infinity
|
||||
assertEq(Atomics.notify(mem, 0), 1); // Last argument to wake should default to +Infinity
|
||||
`);
|
||||
|
||||
var then = Date.now();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue