handle pthread_atfork calling into malloc
This results in compatibility with the malloc replacement support added in musl 1.1.20.pull/50/head
parent
1be74ec40d
commit
684e63a878
9
malloc.c
9
malloc.c
|
@ -609,10 +609,6 @@ COLD static void init_slow_path(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (pthread_atfork(full_lock, full_unlock, post_fork_child)) {
|
||||
fatal_error("pthread_atfork failed");
|
||||
}
|
||||
|
||||
if (sysconf(_SC_PAGESIZE) != PAGE_SIZE) {
|
||||
fatal_error("page size mismatch");
|
||||
}
|
||||
|
@ -673,6 +669,11 @@ COLD static void init_slow_path(void) {
|
|||
}
|
||||
|
||||
pthread_mutex_unlock(&mutex);
|
||||
|
||||
// may allocate, so wait until the allocator is initialized to avoid deadlocking
|
||||
if (pthread_atfork(full_lock, full_unlock, post_fork_child)) {
|
||||
fatal_error("pthread_atfork failed");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void init(void) {
|
||||
|
|
Loading…
Reference in New Issue