If a condition variable is statically initialized don't return

an error. Return successfully without doing anything.
This commit is contained in:
Mike Makonnen 2004-03-29 11:24:02 +00:00
parent 9b9a184d22
commit 61bf8f4731

View File

@ -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);