[英]Behavior of boost::condition_variable::notify_one()
Does the boost::condition_variable::notify_one() function automatically resume execution of the thread it is unblocking or is that undefined and dependent on how the OS schedules the thread? boost :: condition_variable :: notify_one()函数是否自动恢复正在解除阻塞的线程的执行,或者是否未定义并且取决于操作系统如何调度线程?
I am not all that familiar with threading and how the OS interacts with them so any insight into notify_one()'s implementation would be helpful. 我对线程以及操作系统如何与之交互并不十分熟悉,因此对notify_one()的实现有任何了解。
Thanks 谢谢
Boost doesn't resume, nor schedule anything, it talks to the OS and the OS takes care of multi-tasking. Boost不会恢复,也不会计划任何事情,它会与操作系统进行对话,并且操作系统会负责多任务处理。 The OS will most likely unblock the thread some time in the future;
操作系统很可能在将来的某个时间解除线程阻塞; you could have a real-time OS with guarantees (like "unblocked threads will always start execution within X milliseconds"), but Boost doesn't try to guarantee that.
您可能会有一个带有保证的实时操作系统(例如“无阻塞线程将总是在X毫秒内开始执行”),但是Boost并没有保证这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.