@@ -169,6 +169,11 @@ bool emscripten_lock_busyspin_wait_acquire(emscripten_lock_t *lock __attribute__
169169// acquire without contention from other threads.
170170void emscripten_lock_busyspin_waitinf_acquire (emscripten_lock_t * lock __attribute__((nonnull )));
171171
172+ // Callback used in emscripten_lock_async_acquire.
173+ // This currently differs from emscripten_async_wait_callback_t due to the
174+ // address being volatile.
175+ typedef void (* emscripten_async_lock_acquire_callback_t )(volatile void * address , uint32_t value , ATOMICS_WAIT_RESULT_T waitResult , void * userData );
176+
172177// Registers an *asynchronous* lock acquire operation. The calling thread will
173178// asynchronously try to obtain the given lock after the calling thread yields
174179// back to the event loop. If the attempt is successful within
@@ -184,7 +189,7 @@ void emscripten_lock_busyspin_waitinf_acquire(emscripten_lock_t *lock __attribut
184189// use this API in Worker, you cannot utilise an infinite loop programming
185190// model.
186191void emscripten_lock_async_acquire (emscripten_lock_t * lock __attribute__((nonnull )),
187- void ( * asyncWaitFinished )( volatile void * address , uint32_t value , ATOMICS_WAIT_RESULT_T waitResult , void * userData ) __attribute__((nonnull )),
192+ emscripten_async_lock_acquire_callback_t asyncWaitFinished __attribute__((nonnull )),
188193 void * userData ,
189194 double maxWaitMilliseconds );
190195
@@ -218,7 +223,7 @@ int emscripten_semaphore_try_acquire(emscripten_semaphore_t *sem __attribute__((
218223// acquired. If you use this API in Worker, you cannot run an infinite loop.
219224void emscripten_semaphore_async_acquire (emscripten_semaphore_t * sem __attribute__((nonnull )),
220225 int num ,
221- void ( * asyncWaitFinished )( volatile void * address , uint32_t idx , ATOMICS_WAIT_RESULT_T result , void * userData ) __attribute__((nonnull )),
226+ emscripten_async_wait_callback_t asyncWaitFinished __attribute__((nonnull )),
222227 void * userData ,
223228 double maxWaitMilliseconds );
224229
@@ -267,10 +272,11 @@ void emscripten_condvar_waitinf(emscripten_condvar_t *condvar __attribute__((non
267272// the calling thread will not try to reacquire the lock.
268273bool emscripten_condvar_wait (emscripten_condvar_t * condvar __attribute__((nonnull )), emscripten_lock_t * lock __attribute__((nonnull )), int64_t maxWaitNanoseconds );
269274
275+
270276// Asynchronously wait for the given condition variable to signal.
271277ATOMICS_WAIT_TOKEN_T emscripten_condvar_wait_async (emscripten_condvar_t * condvar __attribute__((nonnull )),
272278 emscripten_lock_t * lock __attribute__((nonnull )),
273- void ( * asyncWaitFinished )( int32_t * address , uint32_t value , ATOMICS_WAIT_RESULT_T waitResult , void * userData ) __attribute__((nonnull )),
279+ emscripten_async_wait_callback_t asyncWaitFinished __attribute__((nonnull )),
274280 void * userData ,
275281 double maxWaitMilliseconds );
276282
0 commit comments