Index of Section 2 Manual Pages
| Interix / SUA | pthread_cond_destroy.2 | Interix / SUA |
pthread_cond_destroy(2) pthread_cond_destroy(2)
pthread_cond_destroy()
NAME
pthread_cond_destroy(), pthread_cond_init() - destroy or initialize a
condition variable
SYNOPSIS
#include
int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t
*attr);
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
DESCRIPTION
The pthread_cond_init(2) function initializes the condition variable
referenced by the cond argument using the attributes specified by the attr
argument. If attr is NULL, default condition variable attributes are used,
as though the address of a default condition variable attributes object
had been passed in attr instead. The macro PTHREAD_COND_INITIALIZER can be
used to initialize a statically allocated condition variable with default
attributes.
The pthread_cond_destroy(2) function destroys (uninitializes) the
condition variable referenced by cond. The condition variable must be
reinitialized using pthread_cond_init() before it can be reused.
RETURN VALUES
On success, both functions return 0; otherwise, an error code is returned.
ERRORS
The pthread_cond_destroy() function can fail for the following reasons:
[EBUSY]
An attempt was made to destroy the condition variable referenced by
cond while it was still referenced by another thread. For example, the
application attempted to destroy a condition variable that was being
by another thread in a call to pthread_cond_timedwait(2).
[EINVAL]
The cond value is invalid.
The pthread_cond_init() function can fail for the following reasons:
[EAGAIN]
There were insufficient resources (other than memory) to initialize
the condition variable.
[EBUSY]
An attempt was made to reinitialize an existing condition variable.
[EINVAL]
The attr argument is invalid.
[ENOMEM]
There is not enough memory to initialize the condition variable.
Neither function returns [EINTR].
SEE ALSO
pthread_cond_broadcast(2)
pthread_cond_timedwait(2)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.