mtx_timedlock
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <threads.h> 中定义
|
||
int mtx_timedlock( mtx_t *restrict mutex, const struct timespec *restrict time_point ); |
(C11 起) | |
阻止当前线程,直到互斥量的
mutex
被锁定,直到TIME_UTC基于时间点的time_point
已达到.原文:
Blocks the current thread until the mutex pointed to by
mutex
is locked or until the TIME_UTC based time point pointed to by time_point
has been reached.如果当前线程已经锁定的互斥体,互斥体是不是递归的行为是未定义的.
原文:
The behavior is undefined if the current thread has already locked the mutex and the mutex is not recursive.
互斥体的行为是不确定的,如果不支持超时.
原文:
The behavior is undefined if the mutex does not support timeout.
[编辑] 参数
mutex | - | 指针指向的互斥锁来锁定
|
time_point | - | 指针的超时时间要等到
原文: pointer to the 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, thrd_error if an error occurrs.
[编辑] 另请参阅
(C11) |
阻塞,直到锁定一个互斥体 (函数) |
(C11) |
锁定互斥或返回,不阻塞,如果已经锁定 原文: locks a mutex or returns without blocking if already locked (函数) |
(C11) |
释放一个互斥体 (函数) |