summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2002-08-16 22:10:35 -0700
committerIngo Molnar <mingo@elte.hu>2002-08-16 22:10:35 -0700
commit283522acea308904be3b91df434dc85ed6ec8266 (patch)
tree409298210150ef5e685b26d051dd8f41bcebe353 /kernel
parentb42196802fb09ca427df6ad1e58d684b371fb6f9 (diff)
[PATCH] Thread exit notification by futex
This updates the CLONE_CLEARTID case to use futexes to make it easier to wait for a thread exit. glibc/pthreads had been updated to use the TID-futex, this removes an extra system-call and it also simplifies the pthread_join() code. The pthreads testcode works just fine with the new kernel and does not work with a kernel that does not do the futex wakeup, so it's working fine.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index d577f3077e73..6d0ec09abe0c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -26,6 +26,7 @@
#include <linux/mman.h>
#include <linux/fs.h>
#include <linux/security.h>
+#include <linux/futex.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
@@ -370,12 +371,14 @@ void mm_release(void)
tsk->vfork_done = NULL;
complete(vfork_done);
}
- if (tsk->user_tid)
+ if (tsk->user_tid) {
/*
* We dont check the error code - if userspace has
* not set up a proper pointer then tough luck.
*/
put_user(0UL, tsk->user_tid);
+ sys_futex(tsk->user_tid, FUTEX_WAKE, 1, NULL);
+ }
}
static int copy_mm(unsigned long clone_flags, struct task_struct * tsk)