Standards / Extensions | C or C++ | Dependencies |
---|---|---|
POSIX.4a |
both | POSIX(ON) |
#define _OPEN_THREADS
#include <pthread.h>
int pthread_cond_destroy(pthread_cond_t *cond);
#define _UNIX03_THREADS
#include <pthread.h>
int pthread_cond_destroy(pthread_cond_t *cond);
Destroys the condition variable object specified by cond.
A condition variable object identifies a condition variable. Condition variables are used in conjunction with mutexes to protect shared resources.
If successful, pthread_cond_destroy() returns 0.
Special behavior for Single UNIX Specification, Version 3: If unsuccessful, pthread_cond_destroy() returns an error number to indicate the error.
⁄* CELEBP18 *⁄
#define _OPEN_THREADS
#include <pthread.h>
#include <stdio.h>
main() {
pthread_cond_t cond;
if (pthread_cond_init(&cond, NULL) != 0) {
perror("pthread_cond_init() error");
exit(1);
}
if (pthread_cond_destroy(&cond) != 0) {
perror("pthread_cond_destroy() error");
exit(2);
}
}