19#include "pw_chrono/system_clock.h"
20#include "pw_sync/borrow.h"
21#include "pw_sync/lock_annotations.h"
22#include "pw_sync/lock_traits.h"
23#include "pw_sync/virtual_basic_lockable.h"
30template <
typename GuardedType,
36 static_assert(is_lockable_for_v<LockType, chrono::SystemClock::duration>);
37 static_assert(is_lockable_until_v<LockType, chrono::SystemClock::time_point>);
41 :
Base(
object, lock) {}
52 if (!Base::lock_->try_lock_for(timeout)) {
55 return Base::Borrow();
62 chrono::SystemClock::time_point deadline)
const
63 PW_NO_LOCK_SAFETY_ANALYSIS {
64 if (!Base::lock_->try_lock_until(deadline)) {
67 return Base::Borrow();
Definition: timed_borrow.h:32
std::optional< BorrowedPointer< GuardedType, LockType > > try_acquire_for(chrono::SystemClock::duration timeout) const
Definition: timed_borrow.h:50
std::optional< BorrowedPointer< GuardedType, LockType > > try_acquire_until(chrono::SystemClock::time_point deadline) const
Definition: timed_borrow.h:61
Definition: virtual_basic_lockable.h:29
std::chrono::duration< rep, period > duration
Alias for durations representable with this clock.
Definition: system_clock.h:86