From 2c16cb88a6e5ace0fb7cedca86860ea7bde522a7 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 25 Jun 2021 10:51:31 +0200 Subject: Linux: Move timer helper routines from librt to libc This adds several temporary GLIBC_PRIVATE exports. The symbol names are changed so that they all start with __timer_. It is now possible to invoke the fork handler directly, so pthread_atfork is no longer necessary. The associated error cannot happen anymore, and cancellation handling can be removed from the helper thread routine. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/kernel-posix-timers.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'sysdeps/unix/sysv/linux/kernel-posix-timers.h') diff --git a/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/sysdeps/unix/sysv/linux/kernel-posix-timers.h index 959a81a..17fc32d 100644 --- a/sysdeps/unix/sysv/linux/kernel-posix-timers.h +++ b/sysdeps/unix/sysv/linux/kernel-posix-timers.h @@ -26,19 +26,27 @@ extern int __no_posix_timers attribute_hidden; /* Callback to start helper thread. */ -extern void __start_helper_thread (void) attribute_hidden; +extern void __timer_start_helper_thread (void); +libc_hidden_proto (__timer_start_helper_thread) /* Control variable for helper thread creation. */ -extern pthread_once_t __helper_once attribute_hidden; +extern pthread_once_t __timer_helper_once; +libc_hidden_proto (__timer_helper_once) + +/* Called from fork so that the new subprocess re-creates the + notification thread if necessary. */ +void __timer_fork_subprocess (void) attribute_hidden; /* TID of the helper thread. */ -extern pid_t __helper_tid attribute_hidden; +extern pid_t __timer_helper_tid; +libc_hidden_proto (__timer_helper_tid) /* List of active SIGEV_THREAD timers. */ -extern struct timer *__active_timer_sigev_thread attribute_hidden; -/* Lock for the __active_timer_sigev_thread. */ -extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden; - +extern struct timer *__timer_active_sigev_thread; +libc_hidden_proto (__timer_active_sigev_thread) +/* Lock for __timer_active_sigev_thread. */ +extern pthread_mutex_t __timer_active_sigev_thread_lock; +libc_hidden_proto (__timer_active_sigev_thread_lock) /* Type of timers in the kernel. */ typedef int kernel_timer_t; -- cgit v1.1