2019-12-31 13:59:54 +00:00
|
|
|
#ifndef __TRACYYIELD_HPP__
|
|
|
|
#define __TRACYYIELD_HPP__
|
|
|
|
|
2022-09-11 11:09:59 +00:00
|
|
|
#if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2)
|
2019-12-31 13:59:54 +00:00
|
|
|
# include <emmintrin.h>
|
|
|
|
#else
|
|
|
|
# include <thread>
|
|
|
|
#endif
|
|
|
|
|
2021-05-31 00:19:35 +00:00
|
|
|
#include "TracyForceInline.hpp"
|
2019-12-31 13:59:54 +00:00
|
|
|
|
|
|
|
namespace tracy
|
|
|
|
{
|
|
|
|
|
|
|
|
static tracy_force_inline void YieldThread()
|
|
|
|
{
|
2022-09-11 11:09:59 +00:00
|
|
|
#if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2)
|
2019-12-31 13:59:54 +00:00
|
|
|
_mm_pause();
|
2022-06-22 23:15:55 +00:00
|
|
|
#elif defined __aarch64__
|
|
|
|
asm volatile( "isb" : : );
|
2019-12-31 13:59:54 +00:00
|
|
|
#else
|
|
|
|
std::this_thread::yield();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|