diff --git a/mozglue/misc/Mutex_posix.cpp b/mozglue/misc/Mutex_posix.cpp index f3a501453d51..b16e43b57527 100644 --- a/mozglue/misc/Mutex_posix.cpp +++ b/mozglue/misc/Mutex_posix.cpp @@ -163,7 +163,14 @@ void mozilla::detail::MutexImpl::lock() { mutexLock(); break; } - asm("pause"); // Hint to the processor that we're spinning. + // Hint to the processor that we're spinning. +#ifdef __x86_64__ +# define SPIN_HINT "pause" +#elif defined(__aarch64__) +# define SPIN_HINT "yield" +#endif + asm volatile(SPIN_HINT ::: "memory"); +#undef SPIN_HINT count++; } while (!mutexTryLock());