proxygen
folly::ScopedUnlocker< SynchronizedType, LockPolicy > Class Template Reference

#include <Synchronized.h>

Public Member Functions

 ScopedUnlocker (LockedPtr< SynchronizedType, LockPolicy > *p)
 
 ScopedUnlocker (const ScopedUnlocker &)=delete
 
ScopedUnlockeroperator= (const ScopedUnlocker &)=delete
 
 ScopedUnlocker (ScopedUnlocker &&other) noexcept
 
ScopedUnlockeroperator= (ScopedUnlocker &&other)=delete
 
 ~ScopedUnlocker ()
 
SynchronizedType * getSynchronized () const
 

Private Types

using Data = typename LockedPtr< SynchronizedType, LockPolicy >::UnlockerData
 

Private Attributes

LockedPtr< SynchronizedType, LockPolicy > * ptr_ {nullptr}
 
Data data_
 

Detailed Description

template<class SynchronizedType, class LockPolicy>
class folly::ScopedUnlocker< SynchronizedType, LockPolicy >

This class temporarily unlocks a LockedPtr in a scoped manner.

Definition at line 775 of file Synchronized.h.

Member Typedef Documentation

template<class SynchronizedType, class LockPolicy>
using folly::ScopedUnlocker< SynchronizedType, LockPolicy >::Data = typename LockedPtr<SynchronizedType, LockPolicy>::UnlockerData
private

Definition at line 1271 of file Synchronized.h.

Constructor & Destructor Documentation

template<class SynchronizedType, class LockPolicy>
folly::ScopedUnlocker< SynchronizedType, LockPolicy >::ScopedUnlocker ( LockedPtr< SynchronizedType, LockPolicy > *  p)
inlineexplicit

Definition at line 1249 of file Synchronized.h.

1250  : ptr_(p), data_(ptr_->releaseLock()) {}
LockedPtr< SynchronizedType, LockPolicy > * ptr_
template<class SynchronizedType, class LockPolicy>
folly::ScopedUnlocker< SynchronizedType, LockPolicy >::ScopedUnlocker ( const ScopedUnlocker< SynchronizedType, LockPolicy > &  )
delete
template<class SynchronizedType, class LockPolicy>
folly::ScopedUnlocker< SynchronizedType, LockPolicy >::ScopedUnlocker ( ScopedUnlocker< SynchronizedType, LockPolicy > &&  other)
inlinenoexcept

Definition at line 1253 of file Synchronized.h.

1254  : ptr_(exchange(other.ptr_, nullptr)), data_(std::move(other.data_)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
LockedPtr< SynchronizedType, LockPolicy > * ptr_
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
template<class SynchronizedType, class LockPolicy>
folly::ScopedUnlocker< SynchronizedType, LockPolicy >::~ScopedUnlocker ( )
inline

Definition at line 1257 of file Synchronized.h.

References data_, folly::gen::move, and ptr_.

1257  {
1258  if (ptr_) {
1259  ptr_->reacquireLock(std::move(data_));
1260  }
1261  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
LockedPtr< SynchronizedType, LockPolicy > * ptr_

Member Function Documentation

template<class SynchronizedType, class LockPolicy>
SynchronizedType* folly::ScopedUnlocker< SynchronizedType, LockPolicy >::getSynchronized ( ) const
inline
template<class SynchronizedType, class LockPolicy>
ScopedUnlocker& folly::ScopedUnlocker< SynchronizedType, LockPolicy >::operator= ( const ScopedUnlocker< SynchronizedType, LockPolicy > &  )
delete
template<class SynchronizedType, class LockPolicy>
ScopedUnlocker& folly::ScopedUnlocker< SynchronizedType, LockPolicy >::operator= ( ScopedUnlocker< SynchronizedType, LockPolicy > &&  other)
delete

Member Data Documentation

template<class SynchronizedType, class LockPolicy>
Data folly::ScopedUnlocker< SynchronizedType, LockPolicy >::data_
private

Definition at line 1273 of file Synchronized.h.

template<class SynchronizedType, class LockPolicy>
LockedPtr<SynchronizedType, LockPolicy>* folly::ScopedUnlocker< SynchronizedType, LockPolicy >::ptr_ {nullptr}
private

Definition at line 1272 of file Synchronized.h.


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