Skip to content

Document pthread ordering of sync/async commands [ci skip] #12546

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions system/include/emscripten/threading.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ int emscripten_sync_run_in_main_runtime_thread_(EM_FUNC_SIGNATURE sig, void *fun
// - Note that multiple asynchronous commands from a single pthread/Worker are
// guaranteed to be executed on the main thread in the program order they
// were called in.
// - Note that synchronous and asynchronous commands are *also* guaranteed to
// be executed in order. That is, all commands, sync and async, will not get
// reordered in the queue, but will be executed in the sequential order in
// which they were dispatched. If you issue commands A, B, C, then regardless
// of which of them are sync or async, they will execute in that same order
// on the main runtime thread. The only difference between an async and a
// sync command is that an async one has no return value, and does not block
// the calling thread.
void emscripten_async_run_in_main_runtime_thread_(EM_FUNC_SIGNATURE sig, void *func_ptr, ...);

// The 'async_waitable' variant of the run_in_main_runtime_thread functions run
Expand Down