diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-12-07 16:21:55 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-06-09 15:16:45 -0300 |
commit | f779b1efb35fe141e47952af3ac7f0540acca401 (patch) | |
tree | c85d1e5a2b7f93048159938802f187d98a1b8d09 /nptl/pthreadP.h | |
parent | 8c1c0aae2079039a629b15098d78f3d11aabefb4 (diff) | |
download | glibc-f779b1efb35fe141e47952af3ac7f0540acca401.tar.gz glibc-f779b1efb35fe141e47952af3ac7f0540acca401.tar.xz glibc-f779b1efb35fe141e47952af3ac7f0540acca401.zip |
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.
Diffstat (limited to 'nptl/pthreadP.h')
-rw-r--r-- | nptl/pthreadP.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index 3e7a4f52ab..618922f47a 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -508,11 +508,13 @@ extern int __pthread_once (pthread_once_t *once_control, libc_hidden_proto (__pthread_once) extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)); -extern pthread_t __pthread_self (void); +libc_hidden_proto (__pthread_self) extern int __pthread_equal (pthread_t thread1, pthread_t thread2); extern int __pthread_detach (pthread_t th); libc_hidden_proto (__pthread_detach) extern int __pthread_kill (pthread_t threadid, int signo); +libc_hidden_proto (__pthread_kill) +extern int __pthread_cancel (pthread_t th); extern void __pthread_exit (void *value) __attribute__ ((__noreturn__)); libc_hidden_proto (__pthread_exit) extern int __pthread_join (pthread_t threadid, void **thread_return); |