WebReflection / coincident

An Atomics based Proxy to simplify, and synchronize, Worker related tasks.
MIT License
203 stars 3 forks source link

Added a way to check periodically while awaiting #22

Closed WebReflection closed 1 year ago

WebReflection commented 1 year ago

As suggested in here there is an opportunity to let anyone hook into the awaiting Atomics related dance whenever a worker is paused while the main thread is executing.

This MR should keep anything that was working before exactly the same, but it provides an explicit extra setInterruptHandler to the coincident exported function, mostly usable for advanced use cases as it is the transfer extra field, still enabling those advanced use cases to actually work as expected.

/cc @hoodmane to thank him and have some "OK" around this PR.