10#include <userver/engine/deadline.hpp>
11#include <userver/engine/impl/wait_list_fwd.hpp>
13USERVER_NAMESPACE_BEGIN
33 Mutex(
const Mutex&) =
delete;
34 Mutex(Mutex&&) =
delete;
35 Mutex& operator=(
const Mutex&) =
delete;
36 Mutex& operator=(Mutex&&) =
delete;
69 template <
typename Rep,
typename Period>
70 [[nodiscard]]
bool try_lock_for(
const std::chrono::duration<Rep, Period>&);
81 template <
typename Clock,
typename Duration>
82 [[nodiscard]]
bool try_lock_until(
const std::chrono::time_point<Clock, Duration>&);
85 [[nodiscard]]
bool try_lock_until(Deadline deadline);
90 utils::FastPimpl<Impl, 96,
alignof(
void*)> impl_;
93template <
typename Rep,
typename Period>
94bool Mutex::try_lock_for(
const std::chrono::duration<Rep, Period>& duration) {
95 return try_lock_until(Deadline::FromDuration(duration));
98template <
typename Clock,
typename Duration>
99bool Mutex::try_lock_until(
const std::chrono::time_point<Clock, Duration>& until) {
100 return try_lock_until(Deadline::FromTimePoint(until));