Threading with Web Workers
WebWorkers vs. PThreads
PThreads is the main threading API on posix platforms, such as Linux. It makes it possible to run concurrent threads of execution that have the same view of memory (i.e. they run in the same address space).
PThread in Cheerp?
Cheerp does not support yet PThread APIs, but it’s a work in progress. Please get in touch should you want to be kept informed.
WebWorkers in Cheerp!
Cheerp is designed to give you full access to all browser APIs, including WebWorkers.
Using WebWorkers with Cheerp
You can build these files using the following commands:
For your convenience here is the needed HTML to execute the code
http-server, navigate to the right html, and check the console log.
You should see a greeting echoed back twice through a Worker.