summaryrefslogtreecommitdiffstats
path: root/lib/libc_r
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>1999-05-16 05:25:37 +0000
committerjb <jb@FreeBSD.org>1999-05-16 05:25:37 +0000
commit3a3772dd5647da1cd4a06cca93d8f92cc6e274f0 (patch)
tree932544410a2c628b9e69b5870c109e8fc8473182 /lib/libc_r
parent83a986307949a6c85689d8dc8ae7e610f6eaa789 (diff)
downloadFreeBSD-src-3a3772dd5647da1cd4a06cca93d8f92cc6e274f0.zip
FreeBSD-src-3a3772dd5647da1cd4a06cca93d8f92cc6e274f0.tar.gz
Ensure that an existing thread gets it's state set to PS_DEAD to
prevent being rescheduled. Submitted by: Dan Eischen <eischen@vigrid.com>
Diffstat (limited to 'lib/libc_r')
-rw-r--r--lib/libc_r/uthread/uthread_exit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_exit.c b/lib/libc_r/uthread/uthread_exit.c
index 93b8b83..c54dbda 100644
--- a/lib/libc_r/uthread/uthread_exit.c
+++ b/lib/libc_r/uthread/uthread_exit.c
@@ -164,12 +164,18 @@ pthread_exit(void *status)
if (pthread_cond_signal(&_gc_cond) != 0)
PANIC("Cannot signal gc cond");
+ /*
+ * Mark the thread as dead so it will not return if it
+ * gets context switched out when the mutex is unlocked.
+ */
+ PTHREAD_SET_STATE(_thread_run, PS_DEAD);
+
/* Unlock the garbage collector mutex: */
if (pthread_mutex_unlock(&_gc_mutex) != 0)
PANIC("Cannot lock gc mutex");
/* This this thread will never be re-scheduled. */
- _thread_kern_sched_state(PS_DEAD, __FILE__, __LINE__);
+ _thread_kern_sched(NULL);
/* This point should not be reached. */
PANIC("Dead thread has resumed");
OpenPOWER on IntegriCloud