tail head cat sleep
QR code linking to this page

manページ  — PTHREAD_COND_TIMEDWAIT

名称

pthread_cond_timedwait – 指定した時間の間の条件変数の待機

内容

ライブラリ

Reentrant C\~Library (libc_r, -lc_r)

書式

#include <pthread.h>

int
pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime);

解説

pthread_cond_timedwait() 関数は、 cond で指定された条件変数で待っている現在のスレッドを不可分にブロックし、 mutex で指定された mutex のブロックを解除します。 待っているスレッドは、別のスレッドが pthread_cond_signal(3) または pthread_cond_broadcast(3) を同じ条件変数で呼び出した後、またはシステム時間が abstime に指定された時間に達した場合、にのみブロックが解除され、現在のスレッドは mutex のロックを再取得します。

戻り値

問題がない場合は、 pthread_cond_timedwait() 関数は 0 を返します。 問題がある場合は、そのエラーを示すためにエラー番号が返されます。

エラー

pthread_cond_timedwait() は以下の場合に失敗します。
[EINVAL]
  cond, mutex または abstime によって指定された値が無効です。
[ETIMEDOUT]
  システム時間が、 abstime に指定した時間に達しました。または、超過しました。

関連項目

pthread_cond_broadcast(3), pthread_cond_destroy(3), pthread_cond_init(3), pthread_cond_signal(3), pthread_cond_wait(3)

規格

pthread_cond_timedwait()IEEE Std 1003.1-96 ("POSIX.1") に適合しています。

PTHREAD_COND_TIMEDWAIT (3) July 28, 1998

tail head cat sleep
QR code linking to this page


このマニュアルページサービスについてのご意見は Ben Bullock にお知らせください。 Privacy policy.

The number of UNIX installations has grown to 10, with more expected.
— UNIX Programming Manual, 1972