summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2004-04-13 01:09:56 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2004-04-13 01:09:56 +0000
commitd7f62b0b2e3bd0136f993bec4f9c0b1c02ae274d (patch)
tree98a5c87eae021a8f2bb6f192ac11e1404b2c1b48 /lib/libpthread
parent924ef43b43ab8494440fa1921eadb9d83640d1a9 (diff)
refresh curthread after a thread switch so it points to the real
current thread. ok deraadt@
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/uthread/uthread_kern.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c
index c14810d0943..0b907306f1f 100644
--- a/lib/libpthread/uthread/uthread_kern.c
+++ b/lib/libpthread/uthread/uthread_kern.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_kern.c,v 1.28 2004/04/09 23:57:17 brad Exp $ */
+/* $OpenBSD: uthread_kern.c,v 1.29 2004/04/13 01:09:55 marc Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -470,6 +470,16 @@ _thread_kern_sched(struct sigcontext * scp)
/* Restore the new thread, saving current. */
_thread_machdep_switch(&curthread->_machdep,
&old_thread_run->_machdep);
+
+ /*
+ * DANGER WILL ROBINSON
+ * All stack local variables now contain the values
+ * they had when this thread was last running. In
+ * particular, curthread is NOT pointing to the
+ * current thread. Make it point to the current
+ * before use.
+ */
+ curthread = _get_curthread();
_thread_kern_in_sched = 0;
/* run any installed switch-hooks */