Unfortunately cooperative multithreading is not possible in the default build modes. The limitation is exactly being able to save and restore (or freeze and resume) the stack. It would be possible to build one on top of the Emterpreter build mode I think, but that does not currently exist.
In the experimental SharedArrayBuffer build mode (-s USE_PTHREADS=1), it is possible to do proper multithreading, so that will lift the need for emulating threads. Experimenting with that requires either Firefox Nightly or Chrome Canary build. 2016-10-01 14:33 GMT+03:00 ceisserer <[email protected]>: > Hi, > > Is there any cooperatively scheduling thread emulation library available > for emscripten? I found quite a few 1:n userspace threading libraries (gnu > portable threads, uthread, ...) however all seem to use low-level platform > specific quirks to deal with the issue of switching the context/stack > between threads - which I am quite sure would not work with emscripten. > > In case no such library exists, is there any way to switch the current > stack when using emscripten? > > Thanks in advance, Clemens > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
