Skip to content

Instantly share code, notes, and snippets.

@xaliphostes
xaliphostes / README.md
Last active February 7, 2024 08:53
Emscripten pthread lib in web worker

A small multi-threaded C++ library (so, does not include any main) compiled with emscripten and pthread running under the main thread in the browser, a web worker or using node.js.

Note: Emscripten will produce lib.js.

Using a web browser

Running this lib in the main thread is fine but, obviously, block the main thread. Running it using a web worker leads no error with modification of the worker script (see below)

Using node.js

Run fine except that it prevents Node app from ever exiting.