summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/thread/thr_cond.c
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2003-04-28 23:56:12 +0000
committerdeischen <deischen@FreeBSD.org>2003-04-28 23:56:12 +0000
commit6deabb439b7870759f16db0c9a3968e3755bf61a (patch)
tree90f4ce3660289c401aab5d0a2c4f105e5aa3e877 /lib/libpthread/thread/thr_cond.c
parent0fbdf3450d750b66e54d688d645fc4bafd8739a1 (diff)
downloadFreeBSD-src-6deabb439b7870759f16db0c9a3968e3755bf61a.zip
FreeBSD-src-6deabb439b7870759f16db0c9a3968e3755bf61a.tar.gz
o Don't add a scope system thread's KSE to the list of available
KSEs when it's thread exits; allow the GC handler to do that. o Make spinlock/spinlock critical regions. The following were submitted by davidxu o Alow thr_switch() to take a null mailbox argument. o Better protect cancellation checks. o Don't set KSE specific data when creating new KSEs; rely on the first upcall of the KSE to set it. o Add the ability to set the maximum concurrency level and do this automatically. We should have a way to enable/disable this with some sort of tunable because some applications may not want this to be the default. o Hold the scheduling lock across thread switch calls. o If scheduling of a thread fails, make sure to remove it from the list of active threads. o Better protect accesses to a joining threads when the target thread is exited and detached. o Remove some macro definitions that are now provided by <sys/kse.h>. o Don't leave the library in threaded mode if creation of the initial KSE fails. o Wakeup idle KSEs when there are threads ready to run. o Maintain the number of threads active in the priority queue.
Diffstat (limited to 'lib/libpthread/thread/thr_cond.c')
-rw-r--r--lib/libpthread/thread/thr_cond.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_cond.c b/lib/libpthread/thread/thr_cond.c
index 537c264..32a152d 100644
--- a/lib/libpthread/thread/thr_cond.c
+++ b/lib/libpthread/thread/thr_cond.c
@@ -267,6 +267,7 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
* lock); we should be able to safely
* set the state.
*/
+ THR_LOCK_SWITCH(curthread);
THR_SET_STATE(curthread, PS_COND_WAIT);
/* Remember the CV: */
@@ -280,6 +281,7 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
_thr_sched_switch(curthread);
curthread->data.cond = NULL;
+ THR_UNLOCK_SWITCH(curthread);
/*
* XXX - This really isn't a good check
@@ -324,8 +326,10 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
* that the mutex be reaquired prior to
* cancellation.
*/
- if (done != 0)
+ if (done != 0) {
rval = _mutex_cv_lock(mutex);
+ unlock_mutex = 1;
+ }
}
}
break;
@@ -475,6 +479,7 @@ _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,
* lock); we should be able to safely
* set the state.
*/
+ THR_LOCK_SWITCH(curthread);
THR_SET_STATE(curthread, PS_COND_WAIT);
/* Remember the CV: */
@@ -488,6 +493,7 @@ _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,
_thr_sched_switch(curthread);
curthread->data.cond = NULL;
+ THR_UNLOCK_SWITCH(curthread);
/*
* XXX - This really isn't a good check
OpenPOWER on IntegriCloud