Worklet termination #10169
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: worklets
What problem are you trying to solve?
A way to clean up multi-threaded Wasm resources when a worklet is garbage collected or otherwise finished/closed.
One way to currently do this with dedicated workers:
Atomics.waitAsync()
.Atomics.notify()
.Atomics.wait()
.Atomics.notify()
, callWorker.terminate()
to clean up the worker.Unfortunately this can't be done in worklets because they can't block, therefor there is no way to ensure that Wasm resources aren't being accessed.
What solutions exist today?
The best alternative is to invalidate the Wasm module and making any call to it throw, which doesn't solve the problem but at least prevents unsoundness.
How would you solve it?
A way to terminate worklets, like
Worker.terminate()
and an event that is triggered when the worklet closes. Alternatively only an event if worklets can be properly garbage collected even with a Wasm module.I'm unsure how
FinalizationRegistry
could be used here instead of the event.Anything else?
This is coming from WebAudio/web-audio-api#2568.
The text was updated successfully, but these errors were encountered: