Don’t wait without a condition
Don’t wait without a condition
A wait without a condition can miss a wakeup or wake up simply to find that there is no work to do [1].
What you need to know (or remember) is that also std::timed_mutex::try_lock_for
is allowed to fail spuriously and return false even if the mutex was not locked by any other thread at some point during timeout_duration [2].
Reference
1) https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cp42-dont-wait-without-a-condition 2) https://en.cppreference.com/w/cpp/thread/timed_mutex/try_lock_for