thread_sleep
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <threads.h> 中定义
|
||
int thrd_sleep( const struct timespec* time_point, struct timespec* remaining ); |
(C11 起) | |
已达到阻止当前线程执行的“至少”,直到TIME_UTC的时间点所指向的
time_point
.原文:
Blocks the execution of the current thread for at least until the TIME_UTC based time point pointed to by
time_point
has been reached.的睡眠可以恢复之前的,如果接收到的信号没有被忽略。在这样的情况下,如果
remaining
不是NULL,存入由remaining
指向的对象的剩余持续时间.原文:
The sleep may resume earlier if a signal that is not ignored is received. In such case, if
remaining
is not NULL, the remaining time duration is stored into the object pointed to by remaining
.[编辑] 参数
time_point | - | 指针的时间点才睡觉,
原文: pointer to the time point to sleep until |
remaining | - | 指针的对象,把剩下的时间中断。可能是NULL,在这种情况下,它会被忽略
原文: pointer to the object to put the remaining time on interruption. May be NULL, in which case it is ignored |
[编辑] 返回值
0成功的睡眠,-1如果发生中断,其他负值,如果发生错误.
原文:
0 on successful sleep, -1 if an interrupt occurred, other negative value if an error occurred.
[编辑] 另请参阅
(C11) |
yields the current time slice (函数) |