aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/yield.cpp
blob: c8bbf684e2a7f48c614b56f1ba455a3afa1baa1f (plain) (blame)
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
#include "platform.h" 
 
#ifdef _win_ 
    #include "winint.h" 
    #include <process.h> 
#else 
    #include <pthread.h> 
    #include <sched.h> 
#endif 
 
void SchedYield() noexcept {
#if defined(_unix_) 
    sched_yield(); 
#else 
    Sleep(0); 
#endif 
} 
 
void ThreadYield() noexcept {
#if defined(_freebsd_) 
    pthread_yield(); 
#else 
    SchedYield(); 
#endif 
}