repo.or.cz
/
Arachnida.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Use Vlinder::Atomics
[Arachnida.git]
/
lib
/
Spin
/
Private
/
yield.cpp
blob
0b6fe402285526533b7d8594c33f3952ec08e3a0
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
12
}
13
#endif
14
15
namespace
Spin
16
{
17
namespace
Private
18
{
19
void
yield
(
bool
to_lower
/* = false*/
)
20
{
21
#if defined(_WIN32) || defined(__CYGWIN__)
22
::
Sleep
(
to_lower
?
1
:
0
);
23
#else
24
::
sched_yield
();
25
#endif
26
}
27
}
28
}
29