MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / _pthread_once_raw

Function _pthread_once_raw

include/hamlib/winpthreads.h:243–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241}
242
243static int _pthread_once_raw(pthread_once_t *o, void (*func)(void))
244{
245 long state = *o;
246
247 _ReadWriteBarrier();
248
249 while (state != 1)
250 {
251 if (!state)
252 {
253 if (!_InterlockedCompareExchange(o, 2, 0))
254 {
255 /* Success */
256 func();
257
258 /* Mark as done */
259 *o = 1;
260
261 return 0;
262 }
263 }
264
265 YieldProcessor();
266
267 _ReadWriteBarrier();
268
269 state = *o;
270 }
271
272 /* Done */
273 return 0;
274}
275
276static int pthread_mutex_lock(pthread_mutex_t *m)
277{

Callers 2

pthread_selfFunction · 0.85
pthread_create_wrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected