diff options
author | alex <alex@FreeBSD.org> | 1997-11-25 01:29:16 +0000 |
---|---|---|
committer | alex <alex@FreeBSD.org> | 1997-11-25 01:29:16 +0000 |
commit | 2d792e656e2819795c575a1abeb8dc54e2357484 (patch) | |
tree | afcf53c94eef7b38ab83072ef9f8a80651b0230d /lib/libkse/thread/thr_cond.c | |
parent | 674aa81547dfa76c24a1a45b5acb9119cab75311 (diff) | |
download | FreeBSD-src-2d792e656e2819795c575a1abeb8dc54e2357484.zip FreeBSD-src-2d792e656e2819795c575a1abeb8dc54e2357484.tar.gz |
Modify the return values to comply with POSIX. Previously these
functions would return -1 and set errno to indicate the specific error.
POSIX requires that the functions return the error code as the return
value of the function instead.
Diffstat (limited to 'lib/libkse/thread/thr_cond.c')
-rw-r--r-- | lib/libkse/thread/thr_cond.c | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c index 1f95a2a..978ad04 100644 --- a/lib/libkse/thread/thr_cond.c +++ b/lib/libkse/thread/thr_cond.c @@ -44,8 +44,7 @@ pthread_cond_init(pthread_cond_t * cond, const pthread_condattr_t * cond_attr) int rval = 0; if (cond == NULL) { - errno = EINVAL; - rval = -1; + rval = EINVAL; } else { /* * Check if a pointer to a condition variable attribute @@ -69,8 +68,7 @@ pthread_cond_init(pthread_cond_t * cond, const pthread_condattr_t * cond_attr) /* Trap invalid condition variable types: */ default: /* Return an invalid argument error: */ - errno = EINVAL; - rval = -1; + rval = EINVAL; break; } @@ -78,8 +76,7 @@ pthread_cond_init(pthread_cond_t * cond, const pthread_condattr_t * cond_attr) if (rval == 0) { if ((pcond = (pthread_cond_t) malloc(sizeof(struct pthread_cond))) == NULL) { - errno = ENOMEM; - rval = -1; + rval = ENOMEM; } else { /* * Initialise the condition variable @@ -102,8 +99,7 @@ pthread_cond_destroy(pthread_cond_t * cond) int rval = 0; if (cond == NULL || *cond == NULL) { - errno = EINVAL; - rval = -1; + rval = EINVAL; } else { /* Process according to condition variable type: */ switch ((*cond)->c_type) { @@ -115,8 +111,7 @@ pthread_cond_destroy(pthread_cond_t * cond) /* Trap invalid condition variable types: */ default: /* Return an invalid argument error: */ - errno = EINVAL; - rval = -1; + rval = EINVAL; break; } @@ -140,8 +135,7 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex) int status; if (cond == NULL || *cond == NULL) { - errno = EINVAL; - rval = -1; + rval = EINVAL; } else { /* Block signals: */ _thread_kern_sig_block(&status); @@ -176,8 +170,7 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex) /* Trap invalid condition variable types: */ default: /* Return an invalid argument error: */ - errno = EINVAL; - rval = -1; + rval = EINVAL; break; } @@ -197,8 +190,7 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, int status; if (cond == NULL || *cond == NULL) { - errno = EINVAL; - rval = -1; + rval = EINVAL; } else { /* Block signals: */ _thread_kern_sig_block(&status); @@ -242,8 +234,7 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, /* Check if the wait timed out: */ else if (_thread_run->timeout) { /* Return a timeout error: */ - errno = ETIMEDOUT; - rval = -1; + rval = ETIMEDOUT; } } break; @@ -251,8 +242,7 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, /* Trap invalid condition variable types: */ default: /* Return an invalid argument error: */ - errno = EINVAL; - rval = -1; + rval = EINVAL; break; } @@ -272,8 +262,7 @@ pthread_cond_signal(pthread_cond_t * cond) pthread_t pthread; if (cond == NULL || *cond == NULL) { - errno = EINVAL; - rval = -1; + rval = EINVAL; } else { /* Block signals: */ _thread_kern_sig_block(&status); @@ -292,8 +281,7 @@ pthread_cond_signal(pthread_cond_t * cond) /* Trap invalid condition variable types: */ default: /* Return an invalid argument error: */ - errno = EINVAL; - rval = -1; + rval = EINVAL; break; } @@ -333,8 +321,7 @@ pthread_cond_broadcast(pthread_cond_t * cond) /* Trap invalid condition variable types: */ default: /* Return an invalid argument error: */ - errno = EINVAL; - rval = -1; + rval = EINVAL; break; } |