@webpodjs/net-worker 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abi/ring.js +13 -0
- package/package.json +1 -1
package/dist/abi/ring.js
CHANGED
|
@@ -286,6 +286,19 @@ export async function settleWaits(timeoutMs = 200) {
|
|
|
286
286
|
await Promise.race([Promise.all(all.map((w) => w.settled)), new Promise((r) => (timer = setTimeout(r, timeoutMs)))]);
|
|
287
287
|
clearTimeout(timer);
|
|
288
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* Settles the waits that sleeps on this ring left (a notify on its words), for a ring done with. A
|
|
291
|
+
* waitAsync outlives its sleep (see waitWord), and on a ring nobody writes again it stays pending:
|
|
292
|
+
* it kept the ring's memory, with its waiter, for as long as the thread lived (T334: the FS Worker
|
|
293
|
+
* kept each ended host process's rings, 4 MiB, until Chromium had no room for an ArrayBuffer).
|
|
294
|
+
* Sleeps on the ring wake.
|
|
295
|
+
*/
|
|
296
|
+
export function releaseWaits(ring) {
|
|
297
|
+
const [words] = ring.waitTarget();
|
|
298
|
+
for (const w of pending)
|
|
299
|
+
if (w.words === words)
|
|
300
|
+
Atomics.notify(w.words, w.index);
|
|
301
|
+
}
|
|
289
302
|
/**
|
|
290
303
|
* Sleeps until the word changes from `value`, a notify, the signal aborts, or the watchdog fires.
|
|
291
304
|
* Never blocks the thread.
|