proxygen
folly::LockPolicyFromUpgradeToShared Struct Reference

#include <LockTraits.h>

Inheritance diagram for folly::LockPolicyFromUpgradeToShared:
folly::LockPolicyShared folly::detail::UnlockPolicyShared< LockTraits >

Static Public Member Functions

template<class Mutex >
static std::true_type lock (Mutex &mutex)
 
template<class Mutex , class Rep , class Period >
static bool try_lock_for (Mutex &mutex, const std::chrono::duration< Rep, Period > &)
 
- Static Public Member Functions inherited from folly::LockPolicyShared
template<class Mutex >
static std::true_type lock (Mutex &mutex)
 
template<class Mutex , class Rep , class Period >
static bool try_lock_for (Mutex &mutex, const std::chrono::duration< Rep, Period > &timeout)
 
- Static Public Member Functions inherited from folly::detail::UnlockPolicyShared< LockTraits >
template<typename Mutex >
static void unlock (Mutex &mutex)
 

Additional Inherited Members

- Public Types inherited from folly::LockPolicyShared
using UnlockPolicy = detail::UnlockPolicyShared< LockTraits >
 

Detailed Description

A lock policy with the following mapping

lock() -> unlock_upgrade_and_lock_shared() unlock() -> unlock_shared() try_lock_for -> unlock_upgrade_and_lock_shared()

Definition at line 624 of file LockTraits.h.

Member Function Documentation

template<class Mutex >
static std::true_type folly::LockPolicyFromUpgradeToShared::lock ( Mutex mutex)
inlinestatic

Definition at line 626 of file LockTraits.h.

Referenced by TEST().

626  {
627  LockTraits<Mutex>::unlock_upgrade_and_lock_shared(mutex);
628  return std::true_type{};
629  }
bool_constant< true > true_type
Definition: gtest-port.h:2210
std::mutex mutex
template<class Mutex , class Rep , class Period >
static bool folly::LockPolicyFromUpgradeToShared::try_lock_for ( Mutex mutex,
const std::chrono::duration< Rep, Period > &   
)
inlinestatic

Definition at line 631 of file LockTraits.h.

Referenced by TEST().

633  {
634  LockTraits<Mutex>::unlock_upgrade_and_lock_shared(mutex);
635 
636  // downgrade should be non blocking and should succeed
637  return true;
638  }
std::mutex mutex

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