no longer need glibc pthread_atfork workaround

This commit is contained in:
Daniel Micay 2020-03-29 07:39:23 -04:00
parent 3af44d2e6a
commit 0436227092
2 changed files with 1 additions and 14 deletions

View File

@ -1156,7 +1156,7 @@ COLD static void init_slow_path(void) {
mutex_unlock(&lock); mutex_unlock(&lock);
// may allocate, so wait until the allocator is initialized to avoid deadlocking // may allocate, so wait until the allocator is initialized to avoid deadlocking
if (atfork(full_lock, full_unlock, post_fork_child)) { if (pthread_atfork(full_lock, full_unlock, post_fork_child)) {
fatal_error("pthread_atfork failed"); fatal_error("pthread_atfork failed");
} }
} }

13
util.h
View File

@ -38,19 +38,6 @@ typedef uint32_t u32;
typedef uint64_t u64; typedef uint64_t u64;
typedef unsigned __int128 u128; typedef unsigned __int128 u128;
// use __register_atfork directly to avoid linking with libpthread for glibc < 2.28
#ifdef __GLIBC__
#if !__GLIBC_PREREQ(2, 28)
extern void *__dso_handle;
extern int __register_atfork(void (*)(void), void (*)(void), void (*)(void), void *);
#define atfork(prepare, parent, child) __register_atfork(prepare, parent, child, __dso_handle)
#endif
#endif
#ifndef atfork
#define atfork pthread_atfork
#endif
#if CONFIG_SEAL_METADATA #if CONFIG_SEAL_METADATA
#ifdef __GLIBC__ #ifdef __GLIBC__