1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Use _mm_pause() instead of std::this_thread::yield() if possible.

This commit is contained in:
Bartosz Taudul
2019-12-31 14:59:54 +01:00
parent 8b56386ccd
commit 3a460d3183
5 changed files with 36 additions and 4 deletions
+26
View File
@@ -0,0 +1,26 @@
#ifndef __TRACYYIELD_HPP__
#define __TRACYYIELD_HPP__
#if defined __SSE2__ || defined _M_AMD64 || _M_IX86_FP == 2
# include <emmintrin.h>
#else
# include <thread>
#endif
#include "../common/TracyForceInline.hpp"
namespace tracy
{
static tracy_force_inline void YieldThread()
{
#if defined __SSE2__ || defined _M_AMD64 || _M_IX86_FP == 2
_mm_pause();
#else
std::this_thread::yield();
#endif
}
}
#endif