proxygen
folly::LockTraitsBase< Mutex > Struct Template Reference

#include <LockTraits.h>

Inheritance diagram for folly::LockTraitsBase< Mutex >:
folly::detail::LockTraitsImpl< Mutex, detail::MutexLevelValueImpl< detail::LockInterfaceDispatcher< Mutex >::has_lock_unique, detail::LockInterfaceDispatcher< Mutex >::has_lock_shared, detail::LockInterfaceDispatcher< Mutex >::has_lock_upgrade >::value, detail::LockInterfaceDispatcher< Mutex >::has_lock_timed > folly::LockTraits< Mutex >

Detailed Description

template<class Mutex>
struct folly::LockTraitsBase< Mutex >

LockTraits describes details about a particular mutex type.

The default implementation automatically attempts to detect traits based on the presence of various member functions.

You can specialize LockTraits to provide custom behavior for lock classes that do not use the standard method names (lock()/unlock()/lock_shared()/unlock_shared()/try_lock_for())

LockTraits contains the following members variables:

  • static constexpr bool is_shared True if the lock supports separate shared vs exclusive locking states.
  • static constexpr bool is_timed True if the lock supports acquiring the lock with a timeout.
  • static constexpr bool is_upgrade True if the lock supports an upgradable state

The following static methods always exist:

  • lock(Mutex& mutex)
  • unlock(Mutex& mutex)
  • try_lock(Mutex& mutex)

The following static methods may exist, depending on is_shared, is_timed and is_upgrade:

  • lock_shared()
  • try_lock_shared()
  • try_lock_for()
  • try_lock_shared_for()
  • lock_upgrade()
  • try_lock_upgrade()
  • unlock_upgrade_and_lock()
  • unlock_and_lock_upgrade()
  • unlock_and_lock_shared()
  • unlock_upgrade_and_lock_shared()
  • try_lock_upgrade_for()
  • try_unlock_upgrade_and_lock_for()
  • unlock_shared()
  • unlock_upgrade() Decoupling LockTraits and LockTraitsBase so that if people want to fully specialize LockTraits then they can inherit from LockTraitsBase instead of LockTraits with all the same goodies :)

Definition at line 447 of file LockTraits.h.


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