Skip to content

Commit c471c05

Browse files
committed
doc
1 parent 2a01546 commit c471c05

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

system/include/emscripten/em_asm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ const char __em_asm_sig_builder<__em_asm_type_tuple<Args...> >::buffer[] = { __e
254254
// functions.
255255
#define MAIN_THREAD_EM_ASM(code, ...) ((void)emscripten_asm_const_int_sync_on_main_thread(CODE_EXPR(#code) _EM_ASM_PREP_ARGS(__VA_ARGS__)))
256256

257+
// Runs the given Javascript code on the main browser thread.
258+
// It must be called from a non-main thread.
259+
// The code must return a promise, and this function will wait for the promise
260+
// to resolve or reject, essentially blocking the calling thread until then.
261+
// In either case the function will return an integer, which is the result of the promise.
257262
#define MAIN_THREAD_EM_ASM_PROMISE_AWAIT(code, ...) emscripten_asm_const_int_await_promise_on_main_thread(CODE_EXPR(#code) _EM_ASM_PREP_ARGS(__VA_ARGS__))
258263

259264
// Runs the given JavaScript code synchronously on the main browser thread, and

0 commit comments

Comments
 (0)