proxygen
folly::LockPolicyFromExclusiveToUpgrade Struct Reference

#include <LockTraits.h>

Inheritance diagram for folly::LockPolicyFromExclusiveToUpgrade:
folly::LockPolicyUpgrade folly::detail::UnlockPolicyUpgrade< 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::LockPolicyUpgrade
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::UnlockPolicyUpgrade< LockTraits >
template<typename Mutex >
static void unlock (Mutex &mutex)
 

Additional Inherited Members

- Public Types inherited from folly::LockPolicyUpgrade
using UnlockPolicy = detail::UnlockPolicyUpgrade< LockTraits >
 

Detailed Description

A lock policy with the following mapping

lock() -> unlock_and_lock_upgrade() unlock() -> unlock_upgrade() try_lock_for -> unlock_and_lock_upgrade()

Definition at line 600 of file LockTraits.h.

Member Function Documentation

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

Definition at line 602 of file LockTraits.h.

Referenced by TEST().

602  {
603  LockTraits<Mutex>::unlock_and_lock_upgrade(mutex);
604  return std::true_type{};
605  }
bool_constant< true > true_type
Definition: gtest-port.h:2210
std::mutex mutex
template<class Mutex , class Rep , class Period >
static bool folly::LockPolicyFromExclusiveToUpgrade::try_lock_for ( Mutex mutex,
const std::chrono::duration< Rep, Period > &   
)
inlinestatic

Definition at line 607 of file LockTraits.h.

Referenced by TEST().

609  {
610  LockTraits<Mutex>::unlock_and_lock_upgrade(mutex);
611 
612  // downgrade should be non blocking and should succeed
613  return true;
614  }
std::mutex mutex

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