summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Makonnen <mtm@FreeBSD.org>2004-10-09 15:12:33 +0000
committerMike Makonnen <mtm@FreeBSD.org>2004-10-09 15:12:33 +0000
commit101596b827d3570cefefd0b8a26a0e2e5cb7c23f (patch)
treecf23cfba4d456c7bdc4df8cdec9f9d5329e81832
parentec6386789755c859ca32bd7b5065a5e87059f9fa (diff)
Notes
-rw-r--r--lib/libthr/thread/thr_exit.c6
-rw-r--r--sys/compat/freebsd32/syscalls.master2
-rw-r--r--sys/kern/kern_thr.c6
-rw-r--r--sys/kern/syscalls.master2
-rw-r--r--sys/sys/thr.h2
5 files changed, 9 insertions, 9 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index f71c59a5dfb87..6a4568788f325 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -42,9 +42,6 @@
__weak_reference(_pthread_exit, pthread_exit);
-/* thr_exit() */
-extern int _thr_exit(void);
-
static void deadlist_free_threads();
void
@@ -164,7 +161,6 @@ _pthread_exit(void *status)
deadlist_free_threads();
TAILQ_INSERT_HEAD(&_dead_list, curthread, dle);
TAILQ_REMOVE(&_thread_list, curthread, tle);
- curthread->isdead = 1;
/* If we're the last thread, call it quits */
if (TAILQ_EMPTY(&_thread_list))
@@ -181,7 +177,7 @@ _pthread_exit(void *status)
* thread, which we can't be because we've already checked
* for that.
*/
- _thr_exit();
+ thr_exit((long *)&curthread->isdead);
/* This point should not be reached. */
PANIC("Dead thread has resumed");
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 1babf95361cd3..c2ff8c1d3eb98 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -596,7 +596,7 @@
; XXX implement
429 UNIMPL sigwait
430 MNOPROTO { int thr_create(ucontext_t *ctx, long *id, int flag s); }
-431 MNOPROTO { void thr_exit(void); }
+431 MNOPROTO { void thr_exit(long *state); }
432 MNOPROTO { int thr_self(long *id); }
433 MNOPROTO { int thr_kill(long id, int sig); }
434 MNOPROTO { int _umtx_lock(struct umtx *umtx); }
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 70e786ee293ea..c57b855c76060 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -191,12 +191,16 @@ thr_self(struct thread *td, struct thr_self_args *uap)
int
thr_exit(struct thread *td, struct thr_exit_args *uap)
- /* NULL */
+ /* long *state */
{
struct proc *p;
p = td->td_proc;
+ /* Signal userland that it can free the stack. */
+ if ((void *)uap->state != NULL)
+ suword((void *)uap->state, 1);
+
PROC_LOCK(p);
mtx_lock_spin(&sched_lock);
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 10dac1edc7891..789fd2dcdb2c9 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -614,7 +614,7 @@
acl_type_t type, struct acl *aclp); }
429 MSTD { int sigwait(const sigset_t *set, int *sig); }
430 MSTD { int thr_create(ucontext_t *ctx, long *id, int flags); }
-431 MSTD { void thr_exit(void); }
+431 MSTD { void thr_exit(long *state); }
432 MSTD { int thr_self(long *id); }
433 MSTD { int thr_kill(long id, int sig); }
434 MSTD { int _umtx_lock(struct umtx *umtx); }
diff --git a/sys/sys/thr.h b/sys/sys/thr.h
index ea36af38bb075..4be6d6628b1ef 100644
--- a/sys/sys/thr.h
+++ b/sys/sys/thr.h
@@ -39,7 +39,7 @@
int thr_create(ucontext_t *ctx, long *id, int flags);
int thr_self(long *id);
-void thr_exit(void);
+void thr_exit(long *state);
int thr_kill(long id, int sig);
int thr_suspend(const struct timespec *timeout);
int thr_wake(long id);