Bug 1486039 - use a more-portable idiom for pausing in SpinEvent::Wait; r=aklotz

YieldProcessor is apparently defined to do the same thing on x86 as our
custom macros, but includes implementations for non-x86 processors.
This commit is contained in:
Nathan Froyd 2018-08-28 09:27:57 -04:00
Родитель c551aa18b8
Коммит 5c033bee02
1 изменённых файлов: 1 добавлений и 13 удалений

Просмотреть файл

@ -13,15 +13,6 @@
#include "nsString.h"
#include "nsSystemInfo.h"
// This gives us compiler intrinsics for the x86 PAUSE instruction
#if defined(_MSC_VER)
#include <intrin.h>
#pragma intrinsic(_mm_pause)
#define CPU_PAUSE() _mm_pause()
#elif defined(__GNUC__) || defined(__clang__)
#define CPU_PAUSE() __builtin_ia32_pause()
#endif
namespace mozilla {
namespace mscom {
@ -68,10 +59,7 @@ SpinEvent::Wait(HANDLE aTargetThread)
if (elapsed >= kMaxSpinTime) {
break;
}
// The PAUSE instruction is a hint to the CPU that we're doing a spin
// loop. It is a no-op on older processors that don't support it, so
// it is safe to use here without any CPUID checks.
CPU_PAUSE();
YieldProcessor();
}
if (mDone) {
return true;