proxygen
folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false > Struct Template Reference

#include <LockTraits.h>

Inheritance diagram for folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >:
folly::detail::LockTraitsImpl< Mutex, MutexLevel::SHARED, false > folly::detail::LockTraitsImpl< Mutex, MutexLevel::UNIQUE, false > folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, true >

Static Public Member Functions

static void lock_upgrade (Mutex &mutex)
 
static void unlock_upgrade (Mutex &mutex)
 
static bool try_lock_upgrade (Mutex &mutex)
 
static void unlock_upgrade_and_lock (Mutex &mutex)
 
static void unlock_and_lock_upgrade (Mutex &mutex)
 
static void unlock_and_lock_shared (Mutex &mutex)
 
static void unlock_upgrade_and_lock_shared (Mutex &mutex)
 
- Static Public Member Functions inherited from folly::detail::LockTraitsImpl< Mutex, MutexLevel::SHARED, false >
static void lock_shared (Mutex &mutex)
 
static void unlock_shared (Mutex &mutex)
 
static bool try_lock_shared (Mutex &mutex)
 
- Static Public Member Functions inherited from folly::detail::LockTraitsImpl< Mutex, MutexLevel::UNIQUE, false >
static void lock (Mutex &mutex)
 
static void unlock (Mutex &mutex)
 
static bool try_lock (Mutex &mutex)
 

Static Public Attributes

static constexpr bool is_timed {false}
 
static constexpr bool is_shared {true}
 
static constexpr bool is_upgrade {true}
 
- Static Public Attributes inherited from folly::detail::LockTraitsImpl< Mutex, MutexLevel::SHARED, false >
static constexpr bool is_timed {false}
 
static constexpr bool is_shared {true}
 
static constexpr bool is_upgrade {false}
 
- Static Public Attributes inherited from folly::detail::LockTraitsImpl< Mutex, MutexLevel::UNIQUE, false >
static constexpr bool is_timed {false}
 
static constexpr bool is_shared {false}
 
static constexpr bool is_upgrade {false}
 

Detailed Description

template<class Mutex>
struct folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >

The following methods are supported. There are a few methods

m.lock_upgrade() m.unlock_upgrade() m.try_lock_upgrade()

m.unlock_upgrade_and_lock()

m.unlock_and_lock_upgrade() m.unlock_and_lock_shared() m.unlock_upgrade_and_lock_shared()

m.try_lock_upgrade_for(rel_time) m.try_unlock_upgrade_and_lock_for(rel_time)

Upgrading a shared lock is likely to deadlock when there is more than one thread performing an upgrade. This applies both to upgrading a shared lock to an upgrade lock and to upgrading a shared lock to a unique lock.

Therefore, none of the following methods is supported: unlock_shared_and_lock_upgrade unlock_shared_and_lock try_unlock_shared_and_lock_upgrade try_unlock_shared_and_lock try_unlock_shared_and_lock_upgrade_for try_unlock_shared_and_lock_for

Definition at line 204 of file LockTraits.h.

Member Function Documentation

template<class Mutex >
static void folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::lock_upgrade ( Mutex mutex)
inlinestatic

Acquire the lock in upgradable mode.

Definition at line 213 of file LockTraits.h.

213  {
214  mutex.lock_upgrade();
215  }
std::mutex mutex
template<class Mutex >
static bool folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::try_lock_upgrade ( Mutex mutex)
inlinestatic

Try and acquire the lock in upgrade mode

Definition at line 227 of file LockTraits.h.

227  {
228  return mutex.try_lock_upgrade();
229  }
std::mutex mutex
template<class Mutex >
static void folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::unlock_and_lock_shared ( Mutex mutex)
inlinestatic

Downgrade from an exclusive state to a shared state

Definition at line 248 of file LockTraits.h.

248  {
249  mutex.unlock_and_lock_shared();
250  }
std::mutex mutex
template<class Mutex >
static void folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::unlock_and_lock_upgrade ( Mutex mutex)
inlinestatic

Downgrade from an exclusive state to an upgrade state

Definition at line 241 of file LockTraits.h.

241  {
242  mutex.unlock_and_lock_upgrade();
243  }
std::mutex mutex
template<class Mutex >
static void folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::unlock_upgrade ( Mutex mutex)
inlinestatic

Release the lock in upgrade mode

Definition at line 220 of file LockTraits.h.

220  {
221  mutex.unlock_upgrade();
222  }
std::mutex mutex
template<class Mutex >
static void folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::unlock_upgrade_and_lock ( Mutex mutex)
inlinestatic

Upgrade from an upgradable state to an exclusive state

Definition at line 234 of file LockTraits.h.

234  {
235  mutex.unlock_upgrade_and_lock();
236  }
std::mutex mutex
template<class Mutex >
static void folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::unlock_upgrade_and_lock_shared ( Mutex mutex)
inlinestatic

Downgrade from an upgrade state to a shared state

Definition at line 255 of file LockTraits.h.

255  {
256  mutex.unlock_upgrade_and_lock_shared();
257  }
std::mutex mutex

Member Data Documentation

template<class Mutex >
constexpr bool folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::is_shared {true}
static

Definition at line 207 of file LockTraits.h.

template<class Mutex >
constexpr bool folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::is_timed {false}
static

Definition at line 206 of file LockTraits.h.

template<class Mutex >
constexpr bool folly::detail::LockTraitsImpl< Mutex, MutexLevel::UPGRADE, false >::is_upgrade {true}
static

Definition at line 208 of file LockTraits.h.


The documentation for this struct was generated from the following file: