Skip to main content

Harshal V. LADHE

Web Workers and Worker Threads

Running JavaScript off the main thread with Web Workers in the browser and `worker_threads` in Node.js.

Content tagged web-workers

  • Snippet:JavaScript Spin-Wait Lock with Atomics.pause()

    Spin briefly with Atomics.pause(), then block with Atomics.wait().
    A copy-paste JavaScript spin-then-sleep lock using ES2027 Atomics.pause() and Atomics.wait() over a SharedArrayBuffer, with Node.js and browser worker examples.
    Published at:
    Categories:JavaScript
    Estimated reading time:7 min read