標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
POSIX.4a |
両方 | 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);
条件属性オブジェクトを破棄します。条件変数属性オブジェクトは、mutex 属性オブジェクトに類似しています。これらを使用してアプリケーション内の条件変数の特性を管理できるためです。これらは、生成時に条件変数で使用される値の集合を定義します。
pthread_condattr_init() は、条件変数属性オブジェクトを定義する場合に 使用されます。pthread_condattr_destroy() は、条件変数属性オブジェクトの 定義を削除する場合に使用されます。これらの機能は、移植性の目的で提供されます。
pthread_cond_init() 呼び出し中に NULL パラメーターを提供すると、これらの関数を使用しないで条件変数を定義することができます。詳細は、pthread_cond_init() - 条件変数の初期化を参照してください。
正常に実行された場合、pthread_condattr_destroy() は 0 を戻します。
Single UNIX Specification、バージョン 3 の特殊な動作: 正常に実行されなかった場合、pthread_condattr_destroy() はエラーを示すエラー番号を戻します。
⁄* 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);
}
}