From f779b1efb35fe141e47952af3ac7f0540acca401 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 7 Dec 2020 16:21:55 -0300 Subject: nptl: Implement raise in terms of pthread_kill Now that pthread_kill is provided by libc.so it is possible to implement the generic POSIX implementation as 'pthread_kill(pthread_self(), sig)'. For Linux implementation, pthread_kill read the targeting TID from the TCB. For raise, this it not possible because it would make raise fail when issue after vfork (where creates the resulting process has a different TID from the parent, but its TCB is not updated as for pthread_create). To make raise use pthread_kill, it is make usable from vfork by getting the target thread id through gettid syscall. Checked on x86_64-linux-gnu and aarch64-linux-gnu. --- include/pthread.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/pthread.h b/include/pthread.h index a3e1cf5..1158919 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -16,4 +16,9 @@ extern int __pthread_barrier_wait (pthread_barrier_t *__barrier) /* This function is called to initialize the pthread library. */ extern void __pthread_initialize (void) __attribute__ ((weak)); + +extern int __pthread_kill (pthread_t threadid, int signo); + +extern pthread_t __pthread_self (void); + #endif -- cgit v1.1