Search code examples
c++c++11condition-variablestdthread

std::condition_variable::wait_until function


I have a small question about using this method. Will my thread wake up if the std::chrono::high_resolution_clock::now() is greater then the second parameter(abs_time)?


Solution

  • Section 30.2.4 [thread.req.timing] (more-or-less accurate version available at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3128.html#thread.req.timing) says:

    if Ca > Ct, the waiting function should wake as soon as possible, i.e. Ca + Di + Dm, since the timeout is already satisfied.

    So the answer to your question is "yes".