cnd_timedwait
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <threads.h> 中定义
|
||
(C11 起) | ||
原子锁
mutex
块指向的条件变量的cond
,直到该线程的信号通过cnd_signal或cnd_broadcast,或直到TIME_UTC基于时间点的time_point
已达到所指向的互斥锁。在函数返回前被再次锁定互斥锁.原文:
Atomically locks the mutex pointed to by
mutex
and blocks on the condition variable pointed to by cond
until the thread is signalled by cnd_signal or cnd_broadcast, or until the TIME_UTC based time point pointed to by time_point
has been reached. The mutex is locked again before the function returns.如果互斥已经锁定由调用线程的行为是未定义的.
原文:
The behavior is undefined if the mutex is not already locked by the calling thread.
[编辑] 参数
cond | - | 指针指向的条件变量来阻止
原文: pointer to the condition variable to block on |
mutex | - | 指针的互斥锁解锁的块的持续时间
原文: pointer to the mutex to unlock for the duration of the block |
duration | - | 指针指定超时时间要等到一个对象
原文: pointer to a object specifying timeout time to wait until |
[编辑] 返回值
thrd_success如果成功的话,thrd_timedout如果超时时间已达到互斥被锁定之前,或thrd_error如果发生错误.
原文:
thrd_success if successful, thrd_timedout if the timeout time has been reached before the mutex is locked, or thrd_error if an error occurred.
[编辑] 另请参阅
(C11) |
块的条件变量 (函数) |