| 1 | #ifndef __TRACYYIELD_HPP__ |
| 2 | #define __TRACYYIELD_HPP__ |
| 3 | |
| 4 | #if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2) |
| 5 | # include <emmintrin.h> |
| 6 | #else |
| 7 | # include <thread> |
| 8 | #endif |
| 9 | |
| 10 | #include "TracyForceInline.hpp" |
| 11 | |
| 12 | namespace tracy |
| 13 | { |
| 14 | |
| 15 | static tracy_force_inline void YieldThread() |
| 16 | { |
| 17 | #if defined __SSE2__ || defined _M_AMD64 || (defined _M_IX86_FP && _M_IX86_FP == 2) |
| 18 | _mm_pause(); |
| 19 | #elif defined __aarch64__ |
| 20 | asm volatile( "isb" : : ); |
| 21 | #else |
| 22 | std::this_thread::yield(); |
| 23 | #endif |
| 24 | } |
| 25 | |
| 26 | } |
| 27 | |
| 28 | #endif |