proxygen
folly::LockPolicyFromExclusiveToShared Struct Reference

#include <LockTraits.h>

Inheritance diagram for folly::LockPolicyFromExclusiveToShared:
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_and_lock_shared() unlock() -> unlock_shared() try_lock_for() -> unlock_and_lock_shared()

Definition at line 648 of file LockTraits.h.

Member Function Documentation

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

Definition at line 650 of file LockTraits.h.

Referenced by TEST().

650  {
651  LockTraits<Mutex>::unlock_and_lock_shared(mutex);
652  return std::true_type{};
653  }
bool_constant< true > true_type
Definition: gtest-port.h:2210
std::mutex mutex
template<class Mutex , class Rep , class Period >
static bool folly::LockPolicyFromExclusiveToShared::try_lock_for ( Mutex mutex,
const std::chrono::duration< Rep, Period > &   
)
inlinestatic

Definition at line 655 of file LockTraits.h.

Referenced by TEST().

657  {
658  LockTraits<Mutex>::unlock_and_lock_shared(mutex);
659 
660  // downgrade should be non blocking and should succeed
661  return true;
662  }
std::mutex mutex

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