Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS® UNIX | both | POSIX(ON) |
#define _OPEN_THREADS
#define _OPEN_SYS
#include <pthread.h>
int pthread_condattr_getkind_np(pthread_condattr_t *attr, int *kind);
Gets the attribute kind for the condition variable attribute object attr. Condition variable attribute objects are similar to mutex attribute objects. You can use them to manage the characteristics of condition variables in your application. They define the set of values for the condition variable during its creation.
If successful, pthread_condattr_getkind_np() returns 0.
⁄* CELEBP24 *⁄
#pragma runopts(TEST(ALL))
#ifndef _OPEN_THREADS
#define _OPEN_THREADS
#define _OPEN_SYS ⁄* Needed to identify __COND_NODEBUG and
__COND_DEFAULT *⁄
#endif
#include <stdio.h>
#include <pthread.h>
pthread_condattr_t attr;
int kind;
main() {
if (pthread_condattr_init(&attr) == -1) {
perror("pthread_condattr_init()");
exit(1);
}
if (pthread_condattr_setkind_np(&attr, __COND_NODEBUG) == -1) {
perror("pthread_condattr_setkind_np()");
exit(1);
}
if (pthread_condattr_getkind_np(&attr, &kind) == -1) {
exit(1);
}
switch(kind) {
case __COND_DEFAULT:
printf("\ncondition variable will have no defined attributes");
break;
case __COND_NODEBUG:
printf("\ncondition variable will have nodebug attribute");
break;
default:
printf("\nattribute kind value returned by \
pthread_condattr_getkind_no() unrecognized");
}
exit(0);
}