diff options
author | David Leonard <d@cvs.openbsd.org> | 2001-01-16 04:51:08 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 2001-01-16 04:51:08 +0000 |
commit | 16c719bebc6ea3163d9ddf789b350b1a6cac9083 (patch) | |
tree | 54112e3126cd3e976c545a8b76a3c29117858df6 /lib | |
parent | da3003997b9a0c3df80328dcd2226083baed6489 (diff) |
switch stacks even when restoring a preempted thread. (credit to pefo@)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc_r/uthread/uthread_kern.c | 20 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_kern.c | 20 |
2 files changed, 16 insertions, 24 deletions
diff --git a/lib/libc_r/uthread/uthread_kern.c b/lib/libc_r/uthread/uthread_kern.c index 716c64f63cb..7b723ba8ddd 100644 --- a/lib/libc_r/uthread/uthread_kern.c +++ b/lib/libc_r/uthread/uthread_kern.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_kern.c,v 1.10 2000/10/04 05:55:35 d Exp $ */ +/* $OpenBSD: uthread_kern.c,v 1.11 2001/01/16 04:51:07 d Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -520,6 +520,12 @@ _thread_kern_sched(struct sigcontext * scp) /* Restore errno. */ errno = _thread_run->error; + /* + * Restore the new thread, saving current. + */ + _thread_machdep_switch(&_thread_run->_machdep, + &old_thread_run->_machdep); + /* Check if a signal context was saved: */ if (_thread_run->sig_saved == 1) { /* @@ -542,6 +548,7 @@ _thread_kern_sched(struct sigcontext * scp) thread_run_switch_hook(_last_user_thread, _thread_run); } + _thread_check_cancel(); _thread_sys_sigreturn(&_thread_run->saved_sigcontext); } else { /* @@ -556,18 +563,7 @@ _thread_kern_sched(struct sigcontext * scp) } _thread_check_cancel(); - - /* - * Resume thread _thread_run. - */ - _thread_machdep_switch(&_thread_run->_machdep, - &old_thread_run->_machdep); - /* - * This thread is now the new _thread_run - * again. - */ return; - } /* This point should not be reached. */ diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c index 716c64f63cb..7b723ba8ddd 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.10 2000/10/04 05:55:35 d Exp $ */ +/* $OpenBSD: uthread_kern.c,v 1.11 2001/01/16 04:51:07 d Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -520,6 +520,12 @@ _thread_kern_sched(struct sigcontext * scp) /* Restore errno. */ errno = _thread_run->error; + /* + * Restore the new thread, saving current. + */ + _thread_machdep_switch(&_thread_run->_machdep, + &old_thread_run->_machdep); + /* Check if a signal context was saved: */ if (_thread_run->sig_saved == 1) { /* @@ -542,6 +548,7 @@ _thread_kern_sched(struct sigcontext * scp) thread_run_switch_hook(_last_user_thread, _thread_run); } + _thread_check_cancel(); _thread_sys_sigreturn(&_thread_run->saved_sigcontext); } else { /* @@ -556,18 +563,7 @@ _thread_kern_sched(struct sigcontext * scp) } _thread_check_cancel(); - - /* - * Resume thread _thread_run. - */ - _thread_machdep_switch(&_thread_run->_machdep, - &old_thread_run->_machdep); - /* - * This thread is now the new _thread_run - * again. - */ return; - } /* This point should not be reached. */ |