projects
/
oota-llvm.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Removing the static initializer in ManagedStatic.cpp by using llvm_call_once to initi...
[oota-llvm.git]
/
lib
/
Support
/
Windows
/
Threading.inc
1
#include <winbase.h>
2
3
void llvm::call_once(once_flag &flag, void (*fptr)(void)) {
4
while (flag != Done) {
5
if (flag == Wait) {
6
::Sleep(1);
7
continue;
8
}
9
10
sys::cas_flag old_val = sys::CompareAndSwap(&flag, Wait, Uninitialized);
11
if (old_val == Uninitialized) {
12
fptr();
13
sys::MemoryFence();
14
flag = Done;
15
return;
16
}
17
}
18
sys::MemoryFence();
19
}