diff options
author | mtm <mtm@FreeBSD.org> | 2004-03-29 11:24:02 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-03-29 11:24:02 +0000 |
commit | e278045fdaa9bb007aa03807789a308ba666b8fa (patch) | |
tree | 0835631c5f1441de6c10e9323ea4021eb6ec04ce /lib/libthr | |
parent | 2de3c90500908ce4c9d8a71af2c3a9b6c34691f9 (diff) | |
download | FreeBSD-src-e278045fdaa9bb007aa03807789a308ba666b8fa.zip FreeBSD-src-e278045fdaa9bb007aa03807789a308ba666b8fa.tar.gz |
If a condition variable is statically initialized don't return
an error. Return successfully without doing anything.
Diffstat (limited to 'lib/libthr')
-rw-r--r-- | lib/libthr/thread/thr_cond.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c index 9292669..9597816 100644 --- a/lib/libthr/thread/thr_cond.c +++ b/lib/libthr/thread/thr_cond.c @@ -147,8 +147,12 @@ _pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr) int _pthread_cond_destroy(pthread_cond_t *cond) { - if (cond == NULL || *cond == NULL) - return (EINVAL); + /* + * Short circuit for a statically initialized condvar + * that is being destroyed without having been used. + */ + if (*cond == PTHREAD_COND_INITIALIZER) + return (0); COND_LOCK(*cond); |