mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\minwinbase.h(46): error C2146: syntax error : missing ';' before identifier 'nLength' 1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\minwinbase.h(46): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ... including <windows.h> is actually required. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221244 91177308-0d34-0410-b5e6-96231b3b80d8
25 lines
487 B
C++
25 lines
487 B
C++
#include <windows.h>
|
|
|
|
#ifdef MemoryFence
|
|
// WinNT.h seems to define a MemoryFence macro.
|
|
#undef MemoryFence
|
|
#endif
|
|
|
|
void llvm::call_once(once_flag &flag, void (*fptr)(void)) {
|
|
while (flag != Done) {
|
|
if (flag == Wait) {
|
|
::Sleep(1);
|
|
continue;
|
|
}
|
|
|
|
sys::cas_flag old_val = sys::CompareAndSwap(&flag, Wait, Uninitialized);
|
|
if (old_val == Uninitialized) {
|
|
fptr();
|
|
sys::MemoryFence();
|
|
flag = Done;
|
|
return;
|
|
}
|
|
}
|
|
sys::MemoryFence();
|
|
}
|