MCPcopy Create free account
hub / github.com/acl-dev/acl / tls_calloc

Function tls_calloc

lib_acl/src/stdlib/acl_meter_time.c:53–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52static acl_pthread_once_t once_control = ACL_PTHREAD_ONCE_INIT;
53static void *tls_calloc(size_t len)
54{
55 void *ptr;
56
57 (void) acl_pthread_once(&once_control, once_init);
58 ptr = (void*) acl_pthread_getspecific(once_key);
59 if (ptr == NULL) {
60 ptr = acl_mycalloc(1, len);
61 acl_pthread_setspecific(once_key, ptr);
62 if ((unsigned long) acl_pthread_self() == acl_main_thread_self())
63 __tls = ptr;
64 }
65 return ptr;
66}
67
68typedef struct {
69 struct timeval stamp;

Callers 1

acl_meter_timeFunction · 0.70

Calls 5

acl_pthread_onceFunction · 0.85
acl_pthread_getspecificFunction · 0.85
acl_pthread_setspecificFunction · 0.85
acl_pthread_selfFunction · 0.85
acl_main_thread_selfFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…