Pigweed
C/C++ API Reference
|
Public Member Functions | |
constexpr | TimedBorrowable (GuardedType &object, LockType &lock) noexcept |
template<typename U > | |
constexpr | TimedBorrowable (const Borrowable< U, LockType > &other) |
std::optional< BorrowedPointer< GuardedType, LockType > > | try_acquire_for (chrono::SystemClock::duration timeout) const |
std::optional< BorrowedPointer< GuardedType, LockType > > | try_acquire_until (chrono::SystemClock::time_point deadline) const |
![]() | |
constexpr | Borrowable (GuardedType &object, LockType &lock) noexcept |
template<typename U > | |
constexpr | Borrowable (const Borrowable< U, LockType > &other) |
Borrowable (const Borrowable &)=default | |
Borrowable & | operator= (const Borrowable &)=default |
Borrowable (Borrowable &&other)=default | |
Borrowable & | operator= (Borrowable &&other)=default |
BorrowedPointer< GuardedType, LockType > | acquire () const |
Blocks indefinitely until the object can be borrowed. Failures are fatal. | |
template<int &... ExplicitArgumentBarrier, typename T = LockType, typename = std::enable_if_t<is_lockable_v<T>>> | |
std::optional< BorrowedPointer< GuardedType, LockType > > | try_acquire () const |
TimedBorrowable
extends Borrowable
with additional methods to borrow an object guarded by a lock that implements the TimedLockable C++ named requirement.
|
inline |
Tries to borrow the object. Blocks until the specified timeout has elapsed or the object has been borrowed, whichever comes first. Returns a BorrowedPointer
on success, otherwise std::nullopt
(nothing).
|
inline |
Tries to borrow the object. Blocks until the specified deadline has passed or the object has been borrowed, whichever comes first. Returns a BorrowedPointer
on success, otherwise std::nullopt
(nothing).