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"
32template <
typename GuardedType,
38 static_assert(is_lockable_for_v<LockType, chrono::SystemClock::duration>);
39 static_assert(is_lockable_until_v<LockType, chrono::SystemClock::time_point>);
43 :
Base(
object, lock) {}
55 if (!Base::lock_->try_lock_for(timeout)) {
58 return Base::Borrow();
65 chrono::SystemClock::time_point deadline)
const
67 if (!Base::lock_->try_lock_until(deadline)) {
70 return Base::Borrow();
Definition: timed_borrow.h:34
std::optional< BorrowedPointer< GuardedType, LockType > > try_acquire_for(chrono::SystemClock::duration timeout) const
Definition: timed_borrow.h:53
std::optional< BorrowedPointer< GuardedType, LockType > > try_acquire_until(chrono::SystemClock::time_point deadline) const
Definition: timed_borrow.h:64
Definition: virtual_basic_lockable.h:31
std::chrono::duration< rep, period > duration
Alias for durations representable with this clock.
Definition: system_clock.h:90
#define PW_NO_LOCK_SAFETY_ANALYSIS
Definition: lock_annotations.h:292
Definition: binary_semaphore.h:26