5 ms·
I'd be interested to see how threading support was implemented, seems difficult to do in a browser environment.
by foota 11y ago
I'd be interested to see how threading support was implemented, seems difficult to do in a browser environment.
- chrisseaton 11y agoIt's easy: you could just run n instructions of thread one, then n instructions of thread two, and so on in a loop. To not freeze up the browser, you could periodically yield to it and set a timeout to start running the next thread again.
- foota 11y agoI guess so. I think I was thinking about concurrently running multiple threads.
- chrisseaton 11y agoThat is already concurrent. Do you mean in parallel? Yeah not easy to do that, you'd have to set up web workers and I think sort of manually recreate the shared state with your own coherence protocol!