-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I'm referring to this part:
Lines 26 to 40 in 260cfaf
| #if defined(_M_CEE_PURE) || defined(_M_IX86) || defined(_M_X64) | |
| #define _INTRIN_RELAXED(x) x | |
| #define _INTRIN_ACQUIRE(x) x | |
| #define _INTRIN_RELEASE(x) x | |
| #define _INTRIN_ACQ_REL(x) x | |
| #define _YIELD_PROCESSOR() | |
| #elif defined(_M_ARM) || defined(_M_ARM64) | |
| #define _INTRIN_RELAXED(x) _CONCAT(x, _nf) | |
| #define _INTRIN_ACQUIRE(x) _CONCAT(x, _acq) | |
| #define _INTRIN_RELEASE(x) _CONCAT(x, _rel) | |
| // We don't have interlocked intrinsics for acquire-release ordering, even on | |
| // ARM32/ARM64, so fall back to sequentially consistent. | |
| #define _INTRIN_ACQ_REL(x) x | |
| #define _YIELD_PROCESSOR() __yield() |
In particular, this line:
Line 31 in 260cfaf
| #define _YIELD_PROCESSOR() |
In "winnt.h" it is defined as follows:
#define YieldProcessor _mm_pause
In documentation on YieldProcessor use of pause instruction is documented:
This macro can be called on all processor platforms where Windows is supported, but it has no effect on some platforms. The definition varies from platform to platform. The following are some definitions of this macro in Winnt.h:
#define YieldProcessor() __asm { rep nop } #define YieldProcessor _mm_pause #define YieldProcessor __yield
Other synchronization libraries also make use of pause instruction.
@BillyONeal explained in #613 (comment):
The answer I've heard from folks that supposedly know better is "never
_mm_pauseever" -- that macro was defined long before my time but it was defined as empty for x86/x64 and I don't think we would want to change that without extremely strong profiling evidence that it was a good idea.
Though I understand that there are some folks that know something, it all highly suspicious that this STL is the only library I know that avoids pause.