diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-07-02 14:12:37 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-07-02 14:12:37 +0000 |
commit | edf662e5b9b8021849069f367722be529ea4104a (patch) | |
tree | 0d01aaa623e2155d98354ccafee8e7702ef7193b /lib | |
parent | 70fd43e13428fba16f5bf004904c4f131f842c57 (diff) | |
download | FreeBSD-src-edf662e5b9b8021849069f367722be529ea4104a.zip FreeBSD-src-edf662e5b9b8021849069f367722be529ea4104a.tar.gz |
Set unlock_mutex to 1 after locked mutex.
Use THR_CONDQ_CLEAR not THR_COND_SET in cond_queue_deq, current
cond_queue_deq is not used.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkse/thread/thr_cond.c | 6 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_cond.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c index 59db00f..9e73c61 100644 --- a/lib/libkse/thread/thr_cond.c +++ b/lib/libkse/thread/thr_cond.c @@ -539,8 +539,10 @@ _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, /* The wait timedout. */ rval = ETIMEDOUT; (void)_mutex_cv_lock(mutex); - } else if (interrupted || done) + } else if (interrupted || done) { rval = _mutex_cv_lock(mutex); + unlock_mutex = 1; + } } } break; @@ -738,7 +740,7 @@ cond_queue_deq(pthread_cond_t cond) while ((pthread = TAILQ_FIRST(&cond->c_queue)) != NULL) { TAILQ_REMOVE(&cond->c_queue, pthread, sqe); - THR_CONDQ_SET(pthread); + THR_CONDQ_CLEAR(pthread); if ((pthread->timeout == 0) && (pthread->interrupted == 0)) /* * Only exit the loop when we find a thread diff --git a/lib/libpthread/thread/thr_cond.c b/lib/libpthread/thread/thr_cond.c index 59db00f..9e73c61 100644 --- a/lib/libpthread/thread/thr_cond.c +++ b/lib/libpthread/thread/thr_cond.c @@ -539,8 +539,10 @@ _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, /* The wait timedout. */ rval = ETIMEDOUT; (void)_mutex_cv_lock(mutex); - } else if (interrupted || done) + } else if (interrupted || done) { rval = _mutex_cv_lock(mutex); + unlock_mutex = 1; + } } } break; @@ -738,7 +740,7 @@ cond_queue_deq(pthread_cond_t cond) while ((pthread = TAILQ_FIRST(&cond->c_queue)) != NULL) { TAILQ_REMOVE(&cond->c_queue, pthread, sqe); - THR_CONDQ_SET(pthread); + THR_CONDQ_CLEAR(pthread); if ((pthread->timeout == 0) && (pthread->interrupted == 0)) /* * Only exit the loop when we find a thread |