10#include <userver/engine/deadline.hpp>
11#include <userver/engine/impl/wait_list_fwd.hpp>
13USERVER_NAMESPACE_BEGIN
31 Mutex(
const Mutex&) =
delete;
32 Mutex(Mutex&&) =
delete;
33 Mutex& operator=(
const Mutex&) =
delete;
34 Mutex& operator=(Mutex&&) =
delete;
53 template <
typename Rep,
typename Period>
54 bool try_lock_for(
const std::chrono::duration<Rep, Period>&);
56 template <
typename Clock,
typename Duration>
57 bool try_lock_until(
const std::chrono::time_point<Clock, Duration>&);
59 bool try_lock_until(Deadline deadline);
64 utils::FastPimpl<Impl, 96,
alignof(
void*)> impl_;
67template <
typename Rep,
typename Period>
68bool Mutex::try_lock_for(
const std::chrono::duration<Rep, Period>& duration) {
69 return try_lock_until(Deadline::FromDuration(duration));
72template <
typename Clock,
typename Duration>
73bool Mutex::try_lock_until(
74 const std::chrono::time_point<Clock, Duration>& until) {
75 return try_lock_until(Deadline::FromTimePoint(until));