MCPcopy Create free account
hub / github.com/Inori/GPCS4 / leaveOnceObject

Function leaveOnceObject

3rdParty/winpthreads/src/thread.c:581–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581static void
582leaveOnceObject (collect_once_t *c)
583{
584 collect_once_t *h, *p = NULL;
585 if (!c)
586 return;
587 pthread_spin_lock (&once_global);
588 h = once_obj;
589 while (h != NULL && c != h)
590 h = (p = h)->next;
591
592 if (h)
593 {
594 c->count -= 1;
595 if (c->count == 0)
596 {
597 pthread_mutex_destroy(&c->m);
598 if (!p)
599 once_obj = c->next;
600 else
601 p->next = c->next;
602 free (c);
603 }
604 }
605 else
606 fprintf(stderr, "%p not found?!?!\n", c);
607 pthread_spin_unlock (&once_global);
608}
609
610static void
611_pthread_once_cleanup (void *o)

Callers 3

_pthread_once_cleanupFunction · 0.85
_pthread_once_rawFunction · 0.85
pthread_onceFunction · 0.85

Calls 4

pthread_spin_lockFunction · 0.85
pthread_mutex_destroyFunction · 0.85
pthread_spin_unlockFunction · 0.85
fprintfFunction · 0.50

Tested by

no test coverage detected