proxygen
|
#include <Synchronized.h>
Public Types | |
using | DataType = typename SynchronizedType::DataType |
using | MutexType = typename SynchronizedType::MutexType |
using | Synchronized = typename std::remove_const< SynchronizedType >::type |
Public Types inherited from folly::LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicy > | |
using | MutexType = SynchronizedType::MutexType |
Public Member Functions | |
LockedPtr () | |
LockedPtr (SynchronizedType *parent) | |
template<class Rep , class Period > | |
LockedPtr (SynchronizedType *parent, const std::chrono::duration< Rep, Period > &timeout) | |
LockedPtr (LockedPtr &&rhs) noexcept=default | |
template<typename LockPolicyType , EnableIfSameUnlockPolicy< LockPolicyType > * = nullptr> | |
LockedPtr (LockedPtr< SynchronizedType, LockPolicyType > &&other) noexcept | |
LockedPtr & | operator= (LockedPtr &&rhs) noexcept=default |
template<typename LockPolicyType , EnableIfSameUnlockPolicy< LockPolicyType > * = nullptr> | |
LockedPtr & | operator= (LockedPtr< SynchronizedType, LockPolicyType > &&other) noexcept |
LockedPtr (const LockedPtr &rhs)=delete | |
LockedPtr & | operator= (const LockedPtr &rhs)=delete |
~LockedPtr () | |
bool | isNull () const |
operator bool () const | |
CDataType * | operator-> () const |
CDataType & | operator* () const |
ScopedUnlocker< SynchronizedType, LockPolicy > | scopedUnlock () |
template<typename SyncType = SynchronizedType, typename = typename std::enable_if< LockTraits<typename SyncType::MutexType>::is_upgrade>::type> | |
LockedPtr< SynchronizedType, LockPolicyFromUpgradeToExclusive > | moveFromUpgradeToWrite () |
template<typename SyncType = SynchronizedType, typename = typename std::enable_if< LockTraits<typename SyncType::MutexType>::is_upgrade>::type> | |
LockedPtr< SynchronizedType, LockPolicyFromExclusiveToUpgrade > | moveFromWriteToUpgrade () |
template<typename SyncType = SynchronizedType, typename = typename std::enable_if< LockTraits<typename SyncType::MutexType>::is_upgrade>::type> | |
LockedPtr< SynchronizedType, LockPolicyFromUpgradeToShared > | moveFromUpgradeToRead () |
template<typename SyncType = SynchronizedType, typename = typename std::enable_if< LockTraits<typename SyncType::MutexType>::is_upgrade>::type> | |
LockedPtr< SynchronizedType, LockPolicyFromExclusiveToShared > | moveFromWriteToRead () |
Public Member Functions inherited from folly::LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicy > | |
~LockedPtrBase () | |
void | unlock () |
Private Types | |
using | Base = LockedPtrBase< SynchronizedType, typename SynchronizedType::MutexType, LockPolicy > |
using | UnlockerData = typename Base::UnlockerData |
using | CDataType = detail::SynchronizedDataType< SynchronizedType > |
template<typename LockPolicyOther > | |
using | EnableIfSameUnlockPolicy = std::enable_if_t< std::is_same< typename LockPolicy::UnlockPolicy, typename LockPolicyOther::UnlockPolicy >::value > |
Friends | |
template<typename SynchronizedTypeOther , typename LockPolicyOther > | |
class | LockedPtr |
class | ScopedUnlocker< SynchronizedType, LockPolicy > |
Additional Inherited Members | |
Protected Types inherited from folly::LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicy > | |
using | UnlockerData = SynchronizedType * |
Protected Member Functions inherited from folly::LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicy > | |
LockedPtrBase () | |
LockedPtrBase (SynchronizedType *parent) | |
LockedPtrBase (SynchronizedType *parent, const std::chrono::duration< Rep, Period > &timeout) | |
LockedPtrBase (LockedPtrBase &&rhs) noexcept | |
LockedPtrBase (LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicyType > &&rhs) noexcept | |
LockedPtrBase & | operator= (LockedPtrBase &&rhs) noexcept |
LockedPtrBase & | operator= (LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicyType > &&rhs) noexcept |
void | assignImpl (LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicyLhs > &lhs, LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicyRhs > &rhs) noexcept |
UnlockerData | releaseLock () |
void | reacquireLock (UnlockerData &&data) |
Static Protected Member Functions inherited from folly::LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicy > | |
static SynchronizedType * | getSynchronized (UnlockerData data) |
Protected Attributes inherited from folly::LockedPtrBase< SynchronizedType, SynchronizedType::MutexType, LockPolicy > | |
SynchronizedType * | parent_ |
A LockedPtr keeps a Synchronized<T> object locked for the duration of LockedPtr's existence.
It provides access the datum's members directly by using operator->() and operator*().
The LockPolicy parameter controls whether or not the lock is acquired in exclusive or shared mode.
Definition at line 49 of file Synchronized.h.
|
private |
Definition at line 1295 of file Synchronized.h.
|
private |
Definition at line 1298 of file Synchronized.h.
using folly::LockedPtr< SynchronizedType, LockPolicy >::DataType = typename SynchronizedType::DataType |
Definition at line 1311 of file Synchronized.h.
|
private |
Definition at line 1304 of file Synchronized.h.
using folly::LockedPtr< SynchronizedType, LockPolicy >::MutexType = typename SynchronizedType::MutexType |
Definition at line 1312 of file Synchronized.h.
using folly::LockedPtr< SynchronizedType, LockPolicy >::Synchronized = typename std::remove_const<SynchronizedType>::type |
Definition at line 1313 of file Synchronized.h.
|
private |
Definition at line 1296 of file Synchronized.h.
|
inline |
Creates an uninitialized LockedPtr.
Dereferencing an uninitialized LockedPtr is not allowed.
Definition at line 1321 of file Synchronized.h.
|
inlineexplicit |
Takes a Synchronized<T> and locks it.
Definition at line 1326 of file Synchronized.h.
|
inline |
Takes a Synchronized<T> and attempts to lock it, within the specified timeout.
Blocks until the lock is acquired or until the specified timeout expires. If the timeout expired without acquiring the lock, the LockedPtr will be null, and LockedPtr::isNull() will return true.
Definition at line 1337 of file Synchronized.h.
References folly::pushmi::__adl::noexcept(), and folly::detail::rhs.
|
defaultnoexcept |
Move constructor.
|
inlinenoexcept |
Definition at line 1349 of file Synchronized.h.
References folly::gen::move, folly::pushmi::__adl::noexcept(), and folly::detail::rhs.
|
delete |
|
inline |
|
inline |
Check if this LockedPtr is uninitialized, or points to valid locked data.
This method can be used to check if a timed-acquire operation succeeded. If an acquire operation times out it will result in a null LockedPtr.
A LockedPtr is always either null, or holds a lock to valid data. Methods such as scopedUnlock() reset the LockedPtr to null for the duration of the unlock.
Definition at line 1386 of file Synchronized.h.
|
inline |
Move the locked ptr from an upgrade state to a shared state. The current lock is left in a null state.
Definition at line 1469 of file Synchronized.h.
References folly::exchange(), and type.
|
inline |
Move the locked ptr from an upgrade state to an exclusive state. The current lock is left in a null state.
Definition at line 1441 of file Synchronized.h.
References folly::exchange(), and type.
|
inline |
Move the locked ptr from an exclusive state to a shared state. The current lock is left in a null state.
Definition at line 1483 of file Synchronized.h.
References testing::Args(), D, folly::exchange(), and M.
|
inline |
Move the locked ptr from an exclusive state to an upgrade state. The current lock is left in a null state.
Definition at line 1455 of file Synchronized.h.
References folly::exchange(), and type.
|
inlineexplicit |
Explicit boolean conversion.
Returns !isNull()
Definition at line 1395 of file Synchronized.h.
|
inline |
Access the locked data.
This method should only be used if the LockedPtr is valid.
Definition at line 1413 of file Synchronized.h.
|
inline |
Access the locked data.
This method should only be used if the LockedPtr is valid.
Definition at line 1404 of file Synchronized.h.
|
defaultnoexcept |
Move assignment operator.
|
inlinenoexcept |
Definition at line 1359 of file Synchronized.h.
References folly::gen::move, and folly::detail::rhs.
|
delete |
|
inline |
Temporarily unlock the LockedPtr, and reset it to null.
Returns an helper object that will re-lock and restore the LockedPtr when the helper is destroyed. The LockedPtr may not be dereferenced for as long as this helper object exists.
Definition at line 1424 of file Synchronized.h.
References type.
|
friend |
Definition at line 1308 of file Synchronized.h.
|
friend |
Definition at line 1314 of file Synchronized.h.