summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2011-07-07 09:25:17 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2011-07-07 09:25:17 +0000
commite8c6ba29fc5c5dfa36edadc8e07ae04cde33cb78 (patch)
tree32f2f07e967f22da47930860d32fcb2d8e3790b9 /lib
parent9baedf096b7af66f6c6639d5f2216b192a6d5543 (diff)
When context switching, if the 'new' thread is the same as the 'old'
thread, then the save and restore of errno, FPU, and regs is unnecessary and can be skipped. "looks reasonable" marc@
Diffstat (limited to 'lib')
-rw-r--r--lib/libpthread/uthread/uthread_kern.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c
index fabb2088cd8..dab360b40fe 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.37 2011/01/25 22:55:14 stsp Exp $ */
+/* $OpenBSD: uthread_kern.c,v 1.38 2011/07/07 09:25:16 guenther Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -467,6 +467,13 @@ _thread_kern_sched(struct sigcontext * scp)
curthread->slice_usec = 0;
}
+ /*
+ * If we're 'switching' to the current thread,
+ * then don't bother with the save/restore
+ */
+ if (curthread == old_thread_run)
+ goto after_switch;
+
/* Restore errno. */
errno = curthread->error;
@@ -487,6 +494,8 @@ _thread_kern_sched(struct sigcontext * scp)
*/
curthread = _get_curthread();
+ after_switch:
+
/* Allow signals again. */
_queue_signals = 0;