1 #ifdef JEMALLOC_INTERNAL_TSD_TLS_H
2 #error This file should be included only once, by tsd.h.
4 #define JEMALLOC_INTERNAL_TSD_TLS_H
6 extern __thread tsd_t tsd_tls;
7 extern pthread_key_t tsd_tsd;
8 extern bool tsd_booted;
10 /* Initialization/cleanup. */
11 JEMALLOC_ALWAYS_INLINE bool
13 if (pthread_key_create(&tsd_tsd, &tsd_cleanup) != 0) {
20 JEMALLOC_ALWAYS_INLINE void
25 JEMALLOC_ALWAYS_INLINE bool
30 JEMALLOC_ALWAYS_INLINE bool
31 tsd_booted_get(void) {
35 JEMALLOC_ALWAYS_INLINE bool
36 tsd_get_allocates(void) {
41 JEMALLOC_ALWAYS_INLINE tsd_t *
42 tsd_get(UNUSED bool init) {
47 JEMALLOC_ALWAYS_INLINE void
50 if (likely(&tsd_tls != val)) {
53 if (pthread_setspecific(tsd_tsd, (void *)(&tsd_tls)) != 0) {
54 malloc_write("<jemalloc>: Error setting tsd.\n");