Use Vlinder::Atomics
[Arachnida.git] / lib / Spin / Private / yield.cpp
blob0b6fe402285526533b7d8594c33f3952ec08e3a0
1 #include "yield.h"
2 #if defined(_WIN32) || defined(__CYGWIN__)
3 #include <Windows.h>
4 #else
5 extern "C" {
6 #include <unistd.h>
7 #if defined(_POSIX_PRIORITY_SCHEDULING)
8 #include <sched.h>
9 #else
10 #error "sched_yield not available"
11 #endif
13 #endif
15 namespace Spin
17 namespace Private
19 void yield(bool to_lower/* = false*/)
21 #if defined(_WIN32) || defined(__CYGWIN__)
22 ::Sleep(to_lower ? 1 : 0);
23 #else
24 ::sched_yield();
25 #endif