proxygen
folly::SynchronizedPtr< PointerType, MutexType > Class Template Reference

#include <SynchronizedPtr.h>

Public Types

using pointer_type = PointerType
 
using element_type = typename std::pointer_traits< pointer_type >::element_type
 
using const_element_type = typename std::add_const< element_type >::type
 
using read_locked_element = SynchronizedPtrLockedElement< typename inner_type::ConstLockedPtr, const_element_type >
 
using write_locked_element = SynchronizedPtrLockedElement< typename inner_type::LockedPtr, element_type >
 
using write_locked_pointer = typename inner_type::LockedPtr
 

Public Member Functions

template<typename... Args>
 SynchronizedPtr (Args...args)
 
 SynchronizedPtr ()=default
 
 SynchronizedPtr (SynchronizedPtr const &)=default
 
 SynchronizedPtr (SynchronizedPtr &&)=default
 
SynchronizedPtroperator= (SynchronizedPtr const &)=default
 
SynchronizedPtroperator= (SynchronizedPtr &&)=default
 
read_locked_element rlock () const
 
template<class Function >
auto withRLock (Function &&function) const
 
write_locked_element wlock ()
 
template<class Function >
auto withWLock (Function &&function)
 
write_locked_pointer wlockPointer ()
 
template<class Function >
auto withWLockPointer (Function &&function)
 

Private Types

using inner_type = Synchronized< PointerType, MutexType >
 

Private Attributes

inner_type inner_
 

Detailed Description

template<typename PointerType, typename MutexType = SharedMutex>
class folly::SynchronizedPtr< PointerType, MutexType >

Definition at line 56 of file SynchronizedPtr.h.

Member Typedef Documentation

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::const_element_type = typename std::add_const<element_type>::type

Definition at line 63 of file SynchronizedPtr.h.

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::element_type = typename std::pointer_traits<pointer_type>::element_type

Definition at line 62 of file SynchronizedPtr.h.

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::inner_type = Synchronized<PointerType, MutexType>
private

Definition at line 57 of file SynchronizedPtr.h.

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::pointer_type = PointerType

Definition at line 61 of file SynchronizedPtr.h.

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::read_locked_element = SynchronizedPtrLockedElement< typename inner_type::ConstLockedPtr, const_element_type>

Definition at line 66 of file SynchronizedPtr.h.

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::write_locked_element = SynchronizedPtrLockedElement< typename inner_type::LockedPtr, element_type>

Definition at line 69 of file SynchronizedPtr.h.

template<typename PointerType , typename MutexType = SharedMutex>
using folly::SynchronizedPtr< PointerType, MutexType >::write_locked_pointer = typename inner_type::LockedPtr

Definition at line 70 of file SynchronizedPtr.h.

Constructor & Destructor Documentation

template<typename PointerType , typename MutexType = SharedMutex>
template<typename... Args>
folly::SynchronizedPtr< PointerType, MutexType >::SynchronizedPtr ( Args...  args)
inlineexplicit

Definition at line 73 of file SynchronizedPtr.h.

74  : inner_(std::forward<Args>(args)...) {}
template<typename PointerType , typename MutexType = SharedMutex>
folly::SynchronizedPtr< PointerType, MutexType >::SynchronizedPtr ( )
default
template<typename PointerType , typename MutexType = SharedMutex>
folly::SynchronizedPtr< PointerType, MutexType >::SynchronizedPtr ( SynchronizedPtr< PointerType, MutexType > const &  )
default
template<typename PointerType , typename MutexType = SharedMutex>
folly::SynchronizedPtr< PointerType, MutexType >::SynchronizedPtr ( SynchronizedPtr< PointerType, MutexType > &&  )
default

Member Function Documentation

template<typename PointerType , typename MutexType = SharedMutex>
SynchronizedPtr& folly::SynchronizedPtr< PointerType, MutexType >::operator= ( SynchronizedPtr< PointerType, MutexType > const &  )
default
template<typename PointerType , typename MutexType = SharedMutex>
SynchronizedPtr& folly::SynchronizedPtr< PointerType, MutexType >::operator= ( SynchronizedPtr< PointerType, MutexType > &&  )
default
template<typename PointerType , typename MutexType = SharedMutex>
read_locked_element folly::SynchronizedPtr< PointerType, MutexType >::rlock ( ) const
inline

Definition at line 85 of file SynchronizedPtr.h.

85  {
86  return read_locked_element(inner_.rlock());
87  }
SynchronizedPtrLockedElement< typename inner_type::ConstLockedPtr, const_element_type > read_locked_element
template<typename PointerType , typename MutexType = SharedMutex>
template<class Function >
auto folly::SynchronizedPtr< PointerType, MutexType >::withRLock ( Function &&  function) const
inline

Definition at line 90 of file SynchronizedPtr.h.

References folly::rlock().

90  {
91  return function(*rlock());
92  }
read_locked_element rlock() const
template<typename PointerType , typename MutexType = SharedMutex>
template<class Function >
auto folly::SynchronizedPtr< PointerType, MutexType >::withWLock ( Function &&  function)
inline

Definition at line 99 of file SynchronizedPtr.h.

References folly::wlock().

99  {
100  return function(*wlock());
101  }
write_locked_element wlock()
template<typename PointerType , typename MutexType = SharedMutex>
template<class Function >
auto folly::SynchronizedPtr< PointerType, MutexType >::withWLockPointer ( Function &&  function)
inline

Definition at line 112 of file SynchronizedPtr.h.

112  {
113  return function(*wlockPointer());
114  }
write_locked_pointer wlockPointer()
template<typename PointerType , typename MutexType = SharedMutex>
write_locked_element folly::SynchronizedPtr< PointerType, MutexType >::wlock ( )
inline

Definition at line 94 of file SynchronizedPtr.h.

94  {
95  return write_locked_element(inner_.wlock());
96  }
SynchronizedPtrLockedElement< typename inner_type::LockedPtr, element_type > write_locked_element
template<typename PointerType , typename MutexType = SharedMutex>
write_locked_pointer folly::SynchronizedPtr< PointerType, MutexType >::wlockPointer ( )
inline

Definition at line 107 of file SynchronizedPtr.h.

107  {
108  return inner_.wlock();
109  }

Member Data Documentation

template<typename PointerType , typename MutexType = SharedMutex>
inner_type folly::SynchronizedPtr< PointerType, MutexType >::inner_
private

Definition at line 58 of file SynchronizedPtr.h.


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