2 #ifdef JEMALLOC_H_TYPES
4 typedef struct malloc_mutex_s malloc_mutex_t;
7 # define MALLOC_MUTEX_INITIALIZER
8 #elif (defined(JEMALLOC_OSSPIN))
9 # define MALLOC_MUTEX_INITIALIZER {0}
10 #elif (defined(JEMALLOC_MUTEX_INIT_CB))
11 # define MALLOC_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER, NULL}
13 # if (defined(PTHREAD_MUTEX_ADAPTIVE_NP) && \
14 defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP))
15 # define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_ADAPTIVE_NP
16 # define MALLOC_MUTEX_INITIALIZER {PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP}
18 # define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT
19 # define MALLOC_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER}
25 #ifdef JEMALLOC_H_STRUCTS
27 struct malloc_mutex_s {
29 CRITICAL_SECTION lock;
30 #elif (defined(JEMALLOC_OSSPIN))
32 #elif (defined(JEMALLOC_MUTEX_INIT_CB))
34 malloc_mutex_t *postponed_next;
42 #ifdef JEMALLOC_H_EXTERNS
44 #ifdef JEMALLOC_LAZY_LOCK
48 # define isthreaded true
59 #ifdef JEMALLOC_H_INLINES
61 #ifndef JEMALLOC_ENABLE_INLINE
66 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MUTEX_C_))
73 EnterCriticalSection(&mutex->lock);
74 #elif (defined(JEMALLOC_OSSPIN))
75 OSSpinLockLock(&mutex->lock);
77 pthread_mutex_lock(&mutex->lock);
88 LeaveCriticalSection(&mutex->lock);
89 #elif (defined(JEMALLOC_OSSPIN))
90 OSSpinLockUnlock(&mutex->lock);
92 pthread_mutex_unlock(&mutex->lock);
#define malloc_mutex_lock
Definition: private_namespace.h:237
#define JEMALLOC_INLINE
Definition: jemalloc_internal.h:259
#define malloc_mutex_prefork
Definition: private_namespace.h:240
#define mutex_boot
Definition: private_namespace.h:255
#define malloc_mutex_postfork_parent
Definition: private_namespace.h:239
#define isthreaded
Definition: private_namespace.h:229
#define malloc_mutex_postfork_child
Definition: private_namespace.h:238
#define malloc_mutex_unlock
Definition: private_namespace.h:241
#define malloc_mutex_init
Definition: private_namespace.h:236