Comment

Comment by starmole

You can emulate synchronous await by using a worker thread, marshal your async operation to the main thread, then in the worker use Atomics.wait() to blocking wait on a SharedArrayBuffer variable. Once the async operation completes on main, write back the result to the SharedArrayBuffer and wake up the waiting variable. I believe that's also what emscripten uses to emulate synchronous posix calls.
parent starmole 1 year ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton