forked from 0ad/0ad
Fix Linux compile error
This was SVN commit r7743.
This commit is contained in:
parent
9f66c86d64
commit
ee72115b7a
@ -52,7 +52,7 @@ LibError ModuleInit(volatile ModuleInitState* initState, LibError (*init)())
|
||||
const ModuleInitState latchedInitState = *initState;
|
||||
if(latchedInitState == UNINITIALIZED || latchedInitState == BUSY)
|
||||
{
|
||||
_mm_pause();
|
||||
cpu_Pause();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ LibError ModuleShutdown(volatile ModuleInitState* initState, void (*shutdown)())
|
||||
const ModuleInitState latchedInitState = *initState;
|
||||
if(latchedInitState == INITIALIZED || latchedInitState == BUSY)
|
||||
{
|
||||
_mm_pause();
|
||||
cpu_Pause();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,17 @@ LIB_API void cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment);
|
||||
**/
|
||||
LIB_API void cpu_Serialize();
|
||||
|
||||
/**
|
||||
* pause in spin-wait loops, as a performance optimisation.
|
||||
**/
|
||||
inline void cpu_Pause()
|
||||
{
|
||||
#if MSC_VER && (ARCH_IA32 || ARCH_AMD64)
|
||||
_mm_pause();
|
||||
#elif GCC_VER && (ARCH_IA32 || ARCH_AMD64)
|
||||
__asm__ __volatile__( "rep; nop" : : : "memory" );
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// misc
|
||||
|
Loading…
Reference in New Issue
Block a user