MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / _InitOnceExecuteOnce

Function _InitOnceExecuteOnce

test_common/harness/ThreadPool.cpp:119–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117#define _INIT_ONCE_DONE 2
118
119static BOOL _InitOnceExecuteOnce(_PINIT_ONCE InitOnce, _PINIT_ONCE_FN InitFn,
120 PVOID Parameter, LPVOID *Context)
121{
122 while (*InitOnce != _INIT_ONCE_DONE)
123 {
124 if (*InitOnce != _INIT_ONCE_IN_PROGRESS
125 && _InterlockedCompareExchange(InitOnce, _INIT_ONCE_IN_PROGRESS,
126 _INIT_ONCE_UNINITIALIZED)
127 == _INIT_ONCE_UNINITIALIZED)
128 {
129 InitFn(InitOnce, Parameter, Context);
130 *InitOnce = _INIT_ONCE_DONE;
131 return TRUE;
132 }
133 Sleep(1);
134 }
135 return TRUE;
136}
137#endif // !HAS_INIT_ONCE_EXECUTE_ONCE
138
139// Uncomment the following line if Windows XP support is not required.

Callers 2

ThreadPool_DoFunction · 0.85
GetThreadCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected