Otherwise, if an exception is thrown, both the
condition_variable
object and the arguments are in a valid state (basic guarantee). Additionally, on exception, the state of
lck is attempted to be restored before exiting the function scope (by calling
lck.lock()
).
It may throw
system_error in case of failure (transmitting any error condition from the respective call to
lock or
unlock).
The
predicate version (2) may also throw exceptions thrown by
pred.
Otherwise:
The
unconditional version (1) never throws exceptions (no-throw guarantee).
The
predicate version (2) may throw exceptions thrown by
pred, leaving both the
condition_variable
object and the arguments in a valid state (basic guarantee).
If the function is not able to restore the lock and return at some point (such as if some attempt to lock or unlock throws),
std::terminate is called.