Skip to content

Commit aad5488

Browse files
authored
[docs] Clarify async proxying behavior and add link to asyncify docs. (emscripten-core#26150)
1 parent bd17502 commit aad5488

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

site/source/docs/porting/asyncify.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ You will see something like this:
161161
That shows that the C code only continued to execute after the async JS
162162
completed.
163163

164+
.. _marking_async_functions:
165+
164166
Marking JS library functions as async
165167
#####################################
166168

site/source/docs/porting/pthreads.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ can also be used directly for more precise control over how work is run on
5959
different threads.
6060

6161
When a JS library function is marked as both ``__proxy: 'sync'`` and ``__async:
62-
'auto'`` the calling thread will block until the async operation on the
63-
main thread is completed (i.e. the returned promise is resolved). This allows
62+
'auto'``, it is expected to return a promise
63+
(see :ref:`marking_async_functions`).
64+
The calling thread will block until the async operation on the
65+
main thread is completed (i.e. the returned promise is resolved), and the value
66+
that the promise resolves to will be returned to the caller. This allows
6467
functions that would require :ref:`ASYNCIFY` (when called from the main browser
6568
thread) to be called without :ref:`ASYNCIFY` from a background thread. In other
6669
words, background threads can block on proxied work even without :ref:`ASYNCIFY`

0 commit comments

Comments
 (0)