Lines Matching refs:wrapper
33 tsd_wrapper_t *wrapper = (tsd_wrapper_t *)arg; in tsd_cleanup_wrapper() local
35 if (wrapper->initialized) { in tsd_cleanup_wrapper()
36 wrapper->initialized = false; in tsd_cleanup_wrapper()
37 tsd_cleanup(&wrapper->val); in tsd_cleanup_wrapper()
38 if (wrapper->initialized) { in tsd_cleanup_wrapper()
40 if (pthread_setspecific(tsd_tsd, (void *)wrapper) != 0) in tsd_cleanup_wrapper()
50 malloc_tsd_dalloc(wrapper); in tsd_cleanup_wrapper()
54 tsd_wrapper_set(tsd_wrapper_t *wrapper) { in tsd_wrapper_set() argument
55 if (pthread_setspecific(tsd_tsd, (void *)wrapper) != 0) { in tsd_wrapper_set()
63 tsd_wrapper_t *wrapper = (tsd_wrapper_t *)pthread_getspecific(tsd_tsd); in tsd_wrapper_get() local
65 if (init && unlikely(wrapper == NULL)) { in tsd_wrapper_get()
67 wrapper = (tsd_wrapper_t *) in tsd_wrapper_get()
69 if (wrapper) { in tsd_wrapper_get()
70 return wrapper; in tsd_wrapper_get()
72 wrapper = (tsd_wrapper_t *) in tsd_wrapper_get()
74 block.data = (void *)wrapper; in tsd_wrapper_get()
75 if (wrapper == NULL) { in tsd_wrapper_get()
79 wrapper->initialized = false; in tsd_wrapper_get()
81 wrapper->val = initializer; in tsd_wrapper_get()
83 tsd_wrapper_set(wrapper); in tsd_wrapper_get()
86 return wrapper; in tsd_wrapper_get()
101 tsd_wrapper_t *wrapper; in tsd_boot1() local
102 wrapper = (tsd_wrapper_t *)malloc_tsd_malloc(sizeof(tsd_wrapper_t)); in tsd_boot1()
103 if (wrapper == NULL) { in tsd_boot1()
109 wrapper->initialized = false; in tsd_boot1()
111 wrapper->val = initializer; in tsd_boot1()
112 tsd_wrapper_set(wrapper); in tsd_boot1()
137 tsd_wrapper_t *wrapper; in tsd_get() local
140 wrapper = tsd_wrapper_get(init); in tsd_get()
141 if (tsd_get_allocates() && !init && wrapper == NULL) { in tsd_get()
144 return &wrapper->val; in tsd_get()
149 tsd_wrapper_t *wrapper; in tsd_set() local
152 wrapper = tsd_wrapper_get(true); in tsd_set()
153 if (likely(&wrapper->val != val)) { in tsd_set()
154 wrapper->val = *(val); in tsd_set()
156 wrapper->initialized = true; in tsd_set()