-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browsers #2
Comments
Yes, I think we had pretty good consensus on that. The way this API can be polyfilled is by starting a worker from |
There is the open question if join should be a API of WASI or a method implemented with the existing atomics. At the moment, the current proposal only adds a thread_spawn, leaving the rest to be implemented in WASM code. However, there are some genuine advantages of adding On the other hand, having it in WASM, it is less work for the VMs to implement (so technically no work is simpler than some simple work -- in the case of a native function :D). That is, once we have an implementation. |
In terms of the browsers I don't think it makes any difference if we build If you target the main browser thread then all blocking calls, not just pthread_join, but also pthead_mutex_lock or any atomic.wait instructions already need special handling. In emscripten we do this by conditionally busy-waiting (while also warning that this is not advisable!) if we detect we are running on the main thread. Another way of putting it: If we want to take arbitrary wasm modules that use atomics and run them in the main browser thread then we already require some kind of transform to replace/remove/annotate the As to whether we should just build it on top of |
BTW, in emscripten we use the posixtestsuite of pthread tests to test conformance: https://github.com/emscripten-core/posixtestsuite (forked from http://posixtest.sourceforge.net/). Obviously we have to exclude a good chuck of it that we don't support (e.g a lot of the signal handling stuff): Its certainly helped us find a lot of bugs. |
+1. That's a great suggestion on the test suite! |
BTW, how sure are folks that |
If we can assume the same library implementation controlling both |
@sunfishcode raised that this proposal should also specify what browsers are expected to do for the new wasi method(s).
I immagine for browsers nothing would change and they'd do whatever they do today :). I'm just not sure what exactly that is so it needs a bit of investigation.
The text was updated successfully, but these errors were encountered: