std::condition_variable::wait_until 函数

std::condition_variable::wait_until function

我有一个关于使用这个方法的小问题。 如果 std::chrono::high_resolution_clock::now() 大于第二个参数(abs_time),我的线程会唤醒吗?

第 30.2.4 节 [thread.req.timing](或多或少准确的版本可在 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3128.html#thread.req.timing 获得)说:

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

所以你的问题的答案是"yes"。