|
proxygen
|
#include <Synchronized.h>
Public Types | |
| using | MutexType = std::mutex |
Public Member Functions | |
| ~LockedPtrBase () | |
| LockedPtrBase (LockedPtrBase &&rhs) noexcept | |
| LockedPtrBase & | operator= (LockedPtrBase &&rhs) noexcept |
| template<typename LockPolicyType > | |
| LockedPtrBase (LockedPtrBase< SynchronizedType, std::mutex, LockPolicyType > &&other) noexcept | |
| template<typename LockPolicyType > | |
| LockedPtrBase & | operator= (LockedPtrBase< SynchronizedType, std::mutex, LockPolicyType > &&rhs) noexcept |
| template<typename LockPolicyLhs , typename LockPolicyRhs > | |
| void | assignImpl (LockedPtrBase< SynchronizedType, std::mutex, LockPolicyLhs > &lhs, LockedPtrBase< SynchronizedType, std::mutex, LockPolicyRhs > &rhs) noexcept |
| std::unique_lock< std::mutex > & | getUniqueLock () |
| void | unlock () |
Protected Types | |
| using | UnlockerData = std::pair< std::unique_lock< std::mutex >, SynchronizedType * > |
Protected Member Functions | |
| LockedPtrBase () | |
| LockedPtrBase (SynchronizedType *parent) | |
| UnlockerData | releaseLock () |
| void | reacquireLock (UnlockerData &&data) |
Static Protected Member Functions | |
| static SynchronizedType * | getSynchronized (const UnlockerData &data) |
Protected Attributes | |
| std::unique_lock< std::mutex > | lock_ |
| SynchronizedType * | parent_ = nullptr |
Friends | |
| class | folly::ScopedUnlocker< SynchronizedType, LockPolicy > |
| template<typename S , typename L > | |
| class | folly::LockedPtr |
| template<typename S , typename M , typename L > | |
| class | LockedPtrBase |
LockedPtrBase specialization for use with std::mutex.
When std::mutex is used we use a std::unique_lock to hold the mutex. This makes it possible to use std::condition_variable with a Synchronized<T, std::mutex>.
Definition at line 1119 of file Synchronized.h.
| using folly::LockedPtrBase< SynchronizedType, std::mutex, LockPolicy >::MutexType = std::mutex |
Definition at line 1121 of file Synchronized.h.
|
protected |
Definition at line 1218 of file Synchronized.h.
|
inline |
Destructor releases.
Definition at line 1135 of file Synchronized.h.
|
inlinenoexcept |
Definition at line 1140 of file Synchronized.h.
References folly::exchange(), folly::gen::move, and folly::detail::rhs.
|
inlinenoexcept |
Templated move construct and assignment operators
These allow converting LockedPtr types that have the same unlocking policy to each other.
Definition at line 1154 of file Synchronized.h.
References folly::exchange(), and folly::gen::move.
|
inlineprotected |
Definition at line 1207 of file Synchronized.h.
|
inlineexplicitprotected |
Definition at line 1208 of file Synchronized.h.
References folly::lock(), and parent.
|
inlinenoexcept |
Implementation for the assignment operator
Definition at line 1170 of file Synchronized.h.
References folly::exchange(), folly::gen::move, and folly::detail::rhs.
|
inlinestaticprotected |
Definition at line 1220 of file Synchronized.h.
|
inline |
Get a reference to the std::unique_lock.
This is provided so that callers can use Synchronized<T, std::mutex> with a std::condition_variable.
While this API could be used to bypass the normal Synchronized APIs and manually interact with the underlying unique_lock, this is strongly discouraged.
Definition at line 1188 of file Synchronized.h.
|
inlinenoexcept |
Definition at line 1142 of file Synchronized.h.
References folly::detail::rhs.
|
inlinenoexcept |
Definition at line 1159 of file Synchronized.h.
References folly::detail::rhs.
|
inlineprotected |
Definition at line 1231 of file Synchronized.h.
References folly::data(), and folly::gen::move.
|
inlineprotected |
Definition at line 1224 of file Synchronized.h.
References folly::data(), and folly::gen::move.
|
inline |
Unlock the synchronized data.
The LockedPtr can no longer be dereferenced after unlock() has been called. isValid() will return false on an unlocked LockedPtr.
unlock() can only be called on a LockedPtr that is valid.
Definition at line 1200 of file Synchronized.h.
|
friend |
Friend all instantiations of LockedPtr and LockedPtrBase
Definition at line 1128 of file Synchronized.h.
|
friend |
Definition at line 1122 of file Synchronized.h.
|
friend |
Definition at line 1130 of file Synchronized.h.
|
protected |
Definition at line 1239 of file Synchronized.h.
|
protected |
Definition at line 1240 of file Synchronized.h.