summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Makonnen <mtm@FreeBSD.org>2003-05-31 18:46:55 +0000
committerMike Makonnen <mtm@FreeBSD.org>2003-05-31 18:46:55 +0000
commit3ca087ad0efce4e2392479f4681f600ff9042f27 (patch)
treec5e13994658d48a1b1d11a6c705ad4d2cfe9373e
parent268c932befaf6b7c50e9a97ed6f2f4c5bac7bf40 (diff)
downloadsrc-test2-3ca087ad0efce4e2392479f4681f600ff9042f27.tar.gz
src-test2-3ca087ad0efce4e2392479f4681f600ff9042f27.zip
Notes
-rw-r--r--lib/libthr/thread/thr_cond.c5
-rw-r--r--lib/libthr/thread/thr_mutex.c18
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c
index 95e5589bcff1..6a86b390df52 100644
--- a/lib/libthr/thread/thr_cond.c
+++ b/lib/libthr/thread/thr_cond.c
@@ -529,10 +529,11 @@ cond_queue_enq(pthread_cond_t cond, pthread_t pthread)
static inline int
cond_init(pthread_cond_t *cond)
{
+ int error = 0;
_SPINLOCK(&static_cond_lock);
if (*cond == PTHREAD_COND_INITIALIZER)
- return (_pthread_cond_init(cond, NULL));
+ error = _pthread_cond_init(cond, NULL);
_SPINUNLOCK(&static_cond_lock);
- return (0);
+ return (error);
}
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 5267a32b83d0..50ece6161e6a 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -269,25 +269,23 @@ _pthread_mutex_destroy(pthread_mutex_t * mutex)
static int
init_static(pthread_mutex_t *mutex)
{
+ int error = 0;
_SPINLOCK(&static_init_lock);
- if (*mutex == PTHREAD_MUTEX_INITIALIZER) {
- _SPINUNLOCK(&static_init_lock);
- return(_pthread_mutex_init(mutex, NULL));
- }
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
+ error = _pthread_mutex_init(mutex, NULL);
_SPINUNLOCK(&static_init_lock);
- return (0);
+ return (error);
}
static int
init_static_private(pthread_mutex_t *mutex)
{
+ int error = 0;
_SPINLOCK(&static_init_lock);
- if (*mutex == PTHREAD_MUTEX_INITIALIZER) {
- _SPINUNLOCK(&static_init_lock);
- return (_pthread_mutex_init(mutex, &static_mattr));
- }
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
+ error = _pthread_mutex_init(mutex, &static_mattr);
_SPINUNLOCK(&static_init_lock);
- return (0);
+ return (error);
}
int