Standards / Extensions | C or C++ | Dependencies |
---|---|---|
POSIX.4a |
both | POSIX(ON) |
#define _OPEN_THREADS
#include <pthread.h>
int pthread_condattr_destroy(pthread_condattr_t *attr);
#define _UNIX03_THREADS
#include <pthread.h>
int pthread_condattr_destroy(pthread_condattr_t *attr);
Destroys a condition attribute object. Condition-variable attribute objects are similar to mutex attribute objects because you can use them to manage the characteristics of condition variables in your application. They define the set of values to be used for the condition variable during its creation.
pthread_condattr_init() is used to define a condition variable attribute object. pthread_condattr_destroy() is used to remove the definition of the condition variable attribute object. These functions are provided for portability purposes.
You can define a condition variable without using these functions by supplying a NULL parameter during the pthread_cond_init() call. For more details, refer to pthread_cond_init() — Initialize a condition variable.
If successful, pthread_condattr_destroy() returns 0.
Special behavior for Single UNIX Specification, Version 3: If unsuccessful, pthread_condattr_destroy() returns an error number to indicate the error.
⁄* CELEBP23 *⁄
#define _OPEN_THREADS
#include <pthread.h>
#include <stdio.h>
main() {
pthread_condattr_t cond;
if (pthread_condattr_init(&cond) != 0) {
perror("pthread_condattr_init() error");
exit(1);
}
if (pthread_condattr_destroy(&cond) != 0) {
perror("pthread_condattr_destroy() error");
exit(2);
}
}