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/pthread_self.c | |
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/pthread_self.c')
-rw-r--r-- | nptl/pthread_self.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nptl/pthread_self.c b/nptl/pthread_self.c index f877a2e6bd..196d93fb8e 100644 --- a/nptl/pthread_self.c +++ b/nptl/pthread_self.c @@ -20,7 +20,9 @@ #include <tls.h> pthread_t -pthread_self (void) +__pthread_self (void) { return (pthread_t) THREAD_SELF; } +libc_hidden_def (__pthread_self) +weak_alias (__pthread_self, pthread_self) |