You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tracy/public/common/TracyYield.hpp

29 lines
512 B
C++

#ifndef __TRACYYIELD_HPP__
#define __TRACYYIELD_HPP__
#if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2)
# include <emmintrin.h>
#else
# include <thread>
#endif
#include "TracyForceInline.hpp"
namespace tracy
{
static tracy_force_inline void YieldThread()
{
#if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2)
_mm_pause();
#elif defined __aarch64__
asm volatile( "isb" : : );
#else
std::this_thread::yield();
#endif
}
}
#endif