3 ms·
In Emscripten that uses a pthread implementation layer built on top of Web Workers + a shared wasm Memory. Basically memory is shared, and you have atomic instr
by azakai 4y ago
In Emscripten that uses a pthread implementation layer built on top of Web Workers + a shared wasm Memory. Basically memory is shared, and you have atomic instructions, and each thread of execution gets its own Web Worker.
That has some limitations, but for the most part it works just like you would expect pthreads to.
- jjtheblunt 4y agowhat's the non-most part that differs?
- azakai 4y agoThe main thread is a little special on the Web since it can't block, which can cause issues (like pthread_create doesn't immediately create an available pthread). There are workarounds for most of those issues (like pre-allocating a threadpool), and many applications work well, but sometimes not out of the box. See https://emscripten.org/docs/porting/pthreads.html#special-considerations https://emscripten.org/docs/porting/pthreads.html#special-co...
- jjtheblunt 4y agothank you