From e278045fdaa9bb007aa03807789a308ba666b8fa Mon Sep 17 00:00:00 2001 From: mtm Date: Mon, 29 Mar 2004 11:24:02 +0000 Subject: If a condition variable is statically initialized don't return an error. Return successfully without doing anything. --- lib/libthr/thread/thr_cond.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/libthr') 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); -- cgit v1.1