| 117 | #define _INIT_ONCE_DONE 2 |
| 118 | |
| 119 | static 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. |
no outgoing calls
no test coverage detected