From 7f206ad4bb26e0a2be46cd85318999ccba58875c Mon Sep 17 00:00:00 2001 From: deischen Date: Fri, 16 May 2003 19:58:30 +0000 Subject: Add a method of yielding the current thread with the scheduler lock held (_thr_sched_switch_unlocked()) and use this to avoid dropping the scheduler lock and having the scheduler retake the same lock again. Add a better way of detecting if a low-level lock is in use. When switching out a thread due to blocking in the UTS, don't switch to the KSE's scheduler stack only to switch back to another thread. If possible switch to the new thread directly from the old thread and avoid the overhead of the extra context switch. Check for pending signals on a thread when entering the scheduler and add them to the threads signal frame. This includes some other minor signal fixes. Most of this was a joint effor between davidxu and myself. Reviewed by: davidxu Approved by: re@ (blanket for libpthread) --- lib/libkse/thread/thr_join.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/libkse/thread/thr_join.c') diff --git a/lib/libkse/thread/thr_join.c b/lib/libkse/thread/thr_join.c index 7cbc192..dd69bbb 100644 --- a/lib/libkse/thread/thr_join.c +++ b/lib/libkse/thread/thr_join.c @@ -123,13 +123,15 @@ _pthread_join(pthread_t pthread, void **thread_return) THR_SCHED_UNLOCK(curthread, pthread); _thr_ref_delete(curthread, pthread); - THR_LOCK_SWITCH(curthread); + THR_SCHED_LOCK(curthread, curthread); while (curthread->join_status.thread == pthread) { THR_SET_STATE(curthread, PS_JOIN); + THR_SCHED_UNLOCK(curthread, curthread); /* Schedule the next thread: */ _thr_sched_switch(curthread); + THR_SCHED_LOCK(curthread, curthread); } - THR_UNLOCK_SWITCH(curthread); + THR_SCHED_UNLOCK(curthread, curthread); /* * The thread return value and error are set by the -- cgit v1.1