aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/pthread.c
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-11-18 15:17:07 -0800
committerJeff Brown <jeffbrown@google.com>2011-11-18 16:40:48 -0800
commit10c8ce59a40a1d8ae8f49145eca365b364aabe58 (patch)
tree5157c1d270cda4e2933a0e7fedf8b5ed6b920f96 /libc/bionic/pthread.c
parent4b469eae40368913b2841b390dada6c58296c602 (diff)
downloadandroid_bionic-10c8ce59a40a1d8ae8f49145eca365b364aabe58.tar.gz
android_bionic-10c8ce59a40a1d8ae8f49145eca365b364aabe58.tar.bz2
android_bionic-10c8ce59a40a1d8ae8f49145eca365b364aabe58.zip
Add tgkill syscall.
Use tgkill instead of tkill to implement pthread_kill. This is safer in the event that the thread has already terminated and its id has been reused by a different process. Change-Id: Ied715e11d7eadeceead79f33db5e2b5722954ac9
Diffstat (limited to 'libc/bionic/pthread.c')
-rw-r--r--libc/bionic/pthread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index b893a124f..10fb7b5d6 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -1839,7 +1839,7 @@ static void pthread_key_clean_all(void)
}
// man says this should be in <linux/unistd.h>, but it isn't
-extern int tkill(int tid, int sig);
+extern int tgkill(int tgid, int tid, int sig);
int pthread_kill(pthread_t tid, int sig)
{
@@ -1847,7 +1847,7 @@ int pthread_kill(pthread_t tid, int sig)
int old_errno = errno;
pthread_internal_t * thread = (pthread_internal_t *)tid;
- ret = tkill(thread->kernel_id, sig);
+ ret = tgkill(getpid(), thread->kernel_id, sig);
if (ret < 0) {
ret = errno;
errno = old_errno;