Commit 283522ac authored by Ingo Molnar's avatar Ingo Molnar

[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.
parent b4219680
......@@ -6,4 +6,6 @@
#define FUTEX_WAKE (1)
#define FUTEX_FD (2)
extern asmlinkage int sys_futex(void *uaddr, int op, int val, struct timespec *utime);
#endif
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment