mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-08 23:07:20 +03:00
Refactor/fix background_thread/percpu_arena bootstrapping.
Refactor bootstrapping such that dlsym() is called during the bootstrapping phase that can tolerate reentrant allocation.
This commit is contained in:
parent
596b479d83
commit
b511232fcd
12 changed files with 161 additions and 124 deletions
12
src/mutex.c
12
src/mutex.c
|
|
@ -27,21 +27,11 @@ static malloc_mutex_t *postponed_mutexes = NULL;
|
|||
*/
|
||||
|
||||
#if defined(JEMALLOC_LAZY_LOCK) && !defined(_WIN32)
|
||||
static void
|
||||
pthread_create_once(void) {
|
||||
pthread_create_fptr = load_pthread_create_fptr();
|
||||
assert(isthreaded);
|
||||
}
|
||||
|
||||
JEMALLOC_EXPORT int
|
||||
pthread_create(pthread_t *__restrict thread,
|
||||
const pthread_attr_t *__restrict attr, void *(*start_routine)(void *),
|
||||
void *__restrict arg) {
|
||||
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
|
||||
|
||||
pthread_once(&once_control, pthread_create_once);
|
||||
|
||||
return pthread_create_fptr(thread, attr, start_routine, arg);
|
||||
return pthread_create_wrapper(thread, attr, start_routine, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue