|
| void | lock (Priority_t const p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Locks the associated mutex. Effectively calls mutex()->lock().
|
| |
| Priority_t | lock_priority () const noexcept |
| | TODO.
|
| |
| Lockable * | mutex () const noexcept |
| |
| | operator bool () const noexcept |
| | Checks whether *this owns a locked mutex or not. Effectively calls owns_lock().
|
| |
| | operator Priority_t () const noexcept |
| | TODO.
|
| |
| unique_lock & | operator= (const unique_lock &)=delete |
| |
| unique_lock & | operator= (unique_lock &&other) noexcept |
| |
| bool | owns_lock () const noexcept |
| | Checks whether *this owns a locked mutex or not.
|
| |
| Lockable * | release () noexcept |
| | Breaks the association of the associated mutex, if any, and *this.
No locks are unlocked. If *this held ownership of the associated mutex prior to the call, the caller is now responsible to unlock the mutex.
|
| |
| void | swap (unique_lock &other) noexcept |
| | Exchanges the internal states of the lock objects.
|
| |
| bool | try_lock (Priority_t const p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Tries to lock (i.e., takes ownership of) the associated mutex without blocking. Effectively calls mutex()->try_lock().
std::system_error is thrown if there is no associated mutex or if the mutex is already locked.
|
| |
| template<typename Rep , typename Period > |
| bool | try_lock_for (const std::chrono::duration< Rep, Period > &rtime, Priority_t const p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Tries to lock (i.e., takes ownership of) the associated mutex. Blocks until specified rtime has elapsed or the lock is acquired, whichever comes first. On successful lock acquisition returns true, otherwise returns false.Effectively calls mutex()->try_lock_for(rtime).
This function may block for longer than rtime due to scheduling or resource contention delays.
The standard recommends that a steady clock is used to measure the duration. If an implementation uses a system clock instead, the wait time may also be sensitive to clock adjustments.
std::system_error is thrown if there is no associated mutex or if the mutex is already locked by this std::unique_lock.
|
| |
| template<typename Clock , typename Duration > |
| bool | try_lock_until (const std::chrono::time_point< Clock, Duration > &atime, Priority_t const p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Tries to lock (i.e., takes ownership of) the associated mutex. Blocks until specified atime has been reached or the lock is acquired, whichever comes first. On successful lock acquisition returns true, otherwise returns false. May block for longer than atime until has been reached.
Effectively calls mutex()->try_lock_until(atime).
std::system_error is thrown if there is no associated mutex or if the mutex is already locked by the same thread.
Clock must meet the Clock requirements. The program is ill-formed if std::chrono::is_clock_v<Clock> is false.
|
| |
| | unique_lock () noexcept |
| | Construct a new unique lock object.
|
| |
| | unique_lock (const unique_lock &)=delete |
| |
| template<typename Rep , typename Period > |
| | unique_lock (Lockable &m, const std::chrono::duration< Rep, Period > &rtime, Priority_t p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Construct a new unique lock object.
|
| |
| template<typename Clock , typename Duration > |
| | unique_lock (Lockable &m, const std::chrono::time_point< Clock, Duration > &atime, Priority_t p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Construct a new unique lock object.
|
| |
| | unique_lock (Lockable &m, defer_lock_t) noexcept |
| | Construct a new unique lock object.
|
| |
| | unique_lock (Lockable &m, Priority_t const p, adopt_lock_t) noexcept |
| | Construct a new unique lock object.
|
| |
| | unique_lock (Lockable &m, Priority_t const p, try_to_lock_t) |
| | Construct a new unique lock object.
|
| |
| | unique_lock (Lockable &m, Priority_t const p=BOOST_FAIRNESS_MINIMUM_PRIORITY) |
| | Construct a new unique lock object.
|
| |
| | unique_lock (Lockable &m, try_to_lock_t) |
| | Construct a new unique lock object.
|
| |
| | unique_lock (unique_lock &&other) noexcept |
| | Construct a new unique lock object.
|
| |
| void | unlock () |
| | Unlocks (i.e., releases ownership of) the associated mutex and releases ownership.
std::system_error is thrown if there is no associated mutex or if the mutex is not locked.
|
| |
| | ~unique_lock () |
| | Destroy the unique lock object.
|
| |
template<typename Lockable>
class boost::fairness::unique_lock< Lockable >
The class unique_lock is a general-purpose mutex ownership wrapper allowing deferred locking, time-constrained attempts at locking, recursive locking, transfer of lock ownership, and use with condition variables.
The class unique_lock is movable, but not copyable – it meets the requirements of MoveConstructible and MoveAssignable but not of CopyConstructible or CopyAssignable.
The class unique_lock meets the BasicLockable requirements. If Lockable meets the Lockable requirements, unique_lock also meets the Lockable requirements (ex.: can be used in boost::fairness::lock); if Lockable meets the TimedLockable requirements, unique_lock also meets the TimedLockable requirements.
- Template Parameters
-
| Lockable | : the type of the mutex to lock. The type must meet the BasicLockable requirements. |