Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TracyYield.hpp « common « public - github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 035836cdb9f19be4e97ab01050134707bcebb362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#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