Attempts to acquire a lock on the mutex associated with *this
within the time specified.
template<typename Clock, typename Duration> bool try_lock_until(std::chrono::time_point<Clock,Duration> const& absolute_time);
- Preconditions:
The
Mutextype used to instantiatestd::unique_lockmust meet theTimedLockablerequirements.this->mutex()!=NULL,this->owns_lock()==false.- Effects:
Calls
this->mutex()->try_lock_until(absolute_time).- Returns:
trueif the call tothis->mutex()->try_lock_until()returnedtrue,falseotherwise.- Throws:
Any exceptions thrown by
this->mutex()->try_lock_until().std::system_errorwith an error code ofstd::errc::operation_not_permittedifthis->mutex()==NULL.std::system_errorwith an error code ofstd::errc::resource_deadlock_would_occurifthis->owns_lock()==trueon entry.- Postcondition:
If the function returns
true,this->owns_lock()==true, otherwisethis->owns_lock()==false.
Header
#include <mutex>