@@ -130,7 +130,8 @@ int emscripten_futex_wait(volatile void *addr, uint32_t val, double max_wait_ms)
130130 emscripten_conditional_set_current_thread_status (EM_THREAD_STATUS_RUNNING , EM_THREAD_STATUS_WAITFUTEX );
131131
132132#ifdef __EMSCRIPTEN_PTHREADS__
133- bool cancelable = pthread_self ()-> cancelasync == PTHREAD_CANCEL_ASYNCHRONOUS ;
133+ pthread_t self = pthread_self ();
134+ bool cancelable = self -> cancelasync == PTHREAD_CANCEL_ASYNCHRONOUS ;
134135#else
135136 bool cancelable = false;
136137#endif
@@ -199,19 +200,19 @@ int emscripten_futex_wait(volatile void *addr, uint32_t val, double max_wait_ms)
199200 // the queue, either from the call here directly after setting `sleeping` to
200201 // 1, or from another callsite (e.g. the one in `emscripten_yield`).
201202 if (!is_runtime_thread ) {
202- __pthread_self () -> sleeping = 1 ;
203+ self -> sleeping = 1 ;
203204 _emscripten_process_dlopen_queue ();
204205 }
205206#endif
206207 ret = __builtin_wasm_memory_atomic_wait32 ((int * )addr , val , max_wait_ns );
207208#ifdef EMSCRIPTEN_DYNAMIC_LINKING
208209 if (!is_runtime_thread ) {
209- __pthread_self () -> sleeping = 0 ;
210+ self -> sleeping = 0 ;
210211 _emscripten_process_dlopen_queue ();
211212 }
212213#endif
213214#ifdef __EMSCRIPTEN_PTHREADS__
214- if (cancelable && ret == ATOMICS_WAIT_TIMED_OUT && pthread_self () -> cancel ) {
215+ if (cancelable && ret == ATOMICS_WAIT_TIMED_OUT && self -> cancel ) {
215216 // Break out of the loop early if we were cancelled
216217 break ;
217218 }
0 commit comments