handle pthread_atfork calling into malloc

This results in compatibility with the malloc replacement support added
in musl 1.1.20.
This commit is contained in:
Daniel Micay 2018-09-06 19:43:18 -04:00
parent 1be74ec40d
commit 684e63a878

View File

@ -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) {