зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
c551aa18b8
Коммит
5c033bee02
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче