简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM