std::condition_variable::wait_for
takes an optional predicate to internally handle spurious wakeups. std::future::wait_for
does not have any such optional arguments. Is spurious wakeup something I need to guard against if I want to make sure I wait at least as long as the specified timeout, or is it already handled in some other way?
Only condition variables can wake up "spuriously". Apparently, allowing spurious wake-ups simplifies implementation of condition variables on some systems. (The C++ Programming Language 4th ed.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With