Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

std::future::wait_for spurious wakeup?

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?

like image 602
derpface Avatar asked Jan 23 '15 19:01

derpface


1 Answers

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.)

like image 133
Paul Omta Avatar answered Sep 30 '22 18:09

Paul Omta