File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -105,15 +105,19 @@ void emscripten_lock_waitinf_acquire(emscripten_lock_t *lock) {
105105}
106106
107107bool emscripten_lock_busyspin_wait_acquire (emscripten_lock_t * lock , double maxWaitMilliseconds ) {
108+ // Note: using emscripten_get_now() over emscripten_performance_now() to allow
109+ // compatibility with Audio Worklets (but for workers this will defer to the
110+ // performance call with its higher granularity). We keep the non-busy locks
111+ // using the performance version since they have waits, incompatible with AWs.
108112 emscripten_lock_t val = emscripten_atomic_cas_u32 ((void * )lock , 0 , 1 );
109113 if (!val ) return true;
110114
111- double t = emscripten_performance_now ();
115+ double t = emscripten_get_now ();
112116 double waitEnd = t + maxWaitMilliseconds ;
113117 while (t < waitEnd ) {
114118 val = emscripten_atomic_cas_u32 ((void * )lock , 0 , 1 );
115119 if (!val ) return true;
116- t = emscripten_performance_now ();
120+ t = emscripten_get_now ();
117121 }
118122 return false;
119123}
You can’t perform that action at this time.
0 commit comments