hpx::unlock_guard#
Defined in header hpx/mutex.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
-
template<typename Lock>
class relock_guard# - #include <unlock_guard.hpp>
The class
relock_guardis a mutex wrapper that provides a convenient mechanism for reacquiring a lock that was released by anunlock_guard, for the duration of a scoped block.relock_guardperforms the opposite functionality ofunlock_guardwithin an already-unlocked section.When a
relock_guardobject is created, it takes ownership of the underlyingLockassociated with the givenunlock_guardby locking it. When control leaves the scope in which therelock_guardobject was created, therelock_guardis destructed and the underlyingLockis released again (unlocked), restoring the unlocked state managed by the enclosingunlock_guard. In this way,relock_guardallows a temporarily locked section to be nested within an unlocked section created byunlock_guard.Note
relock_guardis non-copyable and non-movable.- Template Parameters
Lock – The type of the lockable object managed by the associated
unlock_guard.
Public Functions
-
inline explicit relock_guard(unlock_guard<Lock> &ul) noexcept#
-
relock_guard(relock_guard const&) = delete#
-
relock_guard(relock_guard&&) = delete#
-
relock_guard &operator=(relock_guard const&) = delete#
-
relock_guard &operator=(relock_guard&&) = delete#
-
inline ~relock_guard()#
Private Members
-
unlock_guard<Lock> &ul_#
-
template<typename Lock>
class unlock_guard# - #include <unlock_guard.hpp>
The class
unlock_guardis a mutex wrapper that provides a convenient mechanism for releasing a mutex for the duration of a scoped block.unlock_guardperforms the opposite functionality oflock_guard.When a
lock_guardobject is created, it attempts to take ownership of the mutex it is given. When control leaves the scope in which thelock_guardobject was created, thelock_guardis destructed and the mutex is released. Accordingly, when anunlock_guardobject is created, it attempts to release the ownership of the mutex it is given. So, when control leaves the scope in which theunlock_guardobject was created, theunlock_guardis destructed and the mutex is owned again. In this way, the mutex is unlocked in the constructor and locked in the destructor, so that one can have an unlocked section within a locked one.Note
unlock_guardis non-copyable and non-movable.- Template Parameters
Lock – The type of the lockable object managed by the
unlock_guard.
Public Functions
-
unlock_guard(unlock_guard const&) = delete#
-
unlock_guard(unlock_guard&&) = delete#
-
unlock_guard &operator=(unlock_guard const&) = delete#
-
unlock_guard &operator=(unlock_guard&&) = delete#
-
inline ~unlock_guard()#
Friends
- friend class relock_guard< Lock >
-
namespace util
Typedefs
-
using instead = hpx::unlock_guard<Lock>#
-
using instead = hpx::unlock_guard<Lock>#
-
template<typename Lock>