[英]What does boost::condition_variable::timed_wait() return on spurious wakeups?
The boost documentation says: 提升文档说:
Returns: false if the call is returning because the time specified by abs_time was reached, true otherwise. 返回:如果由于由于abs_time指定的时间而返回了调用,则返回false,否则返回true。
But what is returned if there is a spurious wakeup? 但是,如果有虚假唤醒会返回什么?
If the condition variable could figure that it is a spurious wake-up there would be no need to return, would it? 如果条件变量可以认为是虚假唤醒,则无需返回,是吗?
You need to check if the data protected by the mutex and the condition variable has changed to detect a spurious wake-up. 您需要检查由互斥锁和条件变量保护的数据是否已更改以检测虚假唤醒。 The condition variable can not do that for you. 条件变量不能为您做到这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.