proxygen
folly::RWSpinLock::ReadHolder Class Reference

#include <RWSpinLock.h>

Public Member Functions

 ReadHolder (RWSpinLock *lock)
 
 ReadHolder (RWSpinLock &lock)
 
 ReadHolder (ReadHolder &&other) noexcept
 
 ReadHolder (UpgradedHolder &&upgraded)
 
 ReadHolder (WriteHolder &&writer)
 
ReadHolderoperator= (ReadHolder &&other)
 
 ReadHolder (const ReadHolder &other)=delete
 
ReadHolderoperator= (const ReadHolder &other)=delete
 
 ~ReadHolder ()
 
void reset (RWSpinLock *lock=nullptr)
 
void swap (ReadHolder *other)
 

Private Attributes

RWSpinLocklock_
 

Friends

class UpgradedHolder
 
class WriteHolder
 

Detailed Description

Definition at line 314 of file RWSpinLock.h.

Constructor & Destructor Documentation

folly::RWSpinLock::ReadHolder::ReadHolder ( RWSpinLock lock)
inlineexplicit

Definition at line 316 of file RWSpinLock.h.

References lock_, and folly::RWSpinLock::lock_shared().

Referenced by operator=().

316  : lock_(lock) {
317  if (lock_) {
318  lock_->lock_shared();
319  }
320  }
folly::RWSpinLock::ReadHolder::ReadHolder ( RWSpinLock lock)
inlineexplicit

Definition at line 322 of file RWSpinLock.h.

References lock_, and folly::RWSpinLock::lock_shared().

322  : lock_(&lock) {
323  lock_->lock_shared();
324  }
folly::RWSpinLock::ReadHolder::ReadHolder ( ReadHolder &&  other)
inlinenoexcept

Definition at line 326 of file RWSpinLock.h.

326  : lock_(other.lock_) {
327  other.lock_ = nullptr;
328  }
folly::RWSpinLock::ReadHolder::ReadHolder ( UpgradedHolder &&  upgraded)
inlineexplicit

Definition at line 331 of file RWSpinLock.h.

References lock_, and folly::RWSpinLock::unlock_upgrade_and_lock_shared().

331  : lock_(upgraded.lock_) {
332  upgraded.lock_ = nullptr;
333  if (lock_) {
335  }
336  }
void unlock_upgrade_and_lock_shared()
Definition: RWSpinLock.h:251
folly::RWSpinLock::ReadHolder::ReadHolder ( WriteHolder &&  writer)
inlineexplicit

Definition at line 338 of file RWSpinLock.h.

References lock_, and folly::RWSpinLock::unlock_and_lock_shared().

338  : lock_(writer.lock_) {
339  writer.lock_ = nullptr;
340  if (lock_) {
342  }
343  }
void unlock_and_lock_shared()
Definition: RWSpinLock.h:221
folly::RWSpinLock::ReadHolder::ReadHolder ( const ReadHolder other)
delete
folly::RWSpinLock::ReadHolder::~ReadHolder ( )
inline

Definition at line 354 of file RWSpinLock.h.

References lock_, and folly::RWSpinLock::unlock_shared().

354  {
355  if (lock_) {
356  lock_->unlock_shared();
357  }
358  }
void unlock_shared()
Definition: RWSpinLock.h:216

Member Function Documentation

ReadHolder& folly::RWSpinLock::ReadHolder::operator= ( ReadHolder &&  other)
inline

Definition at line 345 of file RWSpinLock.h.

References lock_, ReadHolder(), swap(), and folly::f14::swap().

Referenced by folly::RWSpinLock::UpgradedHolder::operator=(), and folly::RWSpinLock::WriteHolder::operator=().

345  {
346  using std::swap;
347  swap(lock_, other.lock_);
348  return *this;
349  }
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414
void swap(ReadHolder *other)
Definition: RWSpinLock.h:373
ReadHolder& folly::RWSpinLock::ReadHolder::operator= ( const ReadHolder other)
delete
void folly::RWSpinLock::ReadHolder::reset ( RWSpinLock lock = nullptr)
inline

Definition at line 360 of file RWSpinLock.h.

References folly::RWSpinLock::lock(), lock_, folly::RWSpinLock::lock_shared(), and folly::RWSpinLock::unlock_shared().

360  {
361  if (lock == lock_) {
362  return;
363  }
364  if (lock_) {
365  lock_->unlock_shared();
366  }
367  lock_ = lock;
368  if (lock_) {
369  lock_->lock_shared();
370  }
371  }
void unlock_shared()
Definition: RWSpinLock.h:216
void folly::RWSpinLock::ReadHolder::swap ( ReadHolder other)
inline

Definition at line 373 of file RWSpinLock.h.

References lock_, and folly::f14::swap().

Referenced by operator=(), folly::RWSpinLock::UpgradedHolder::operator=(), folly::RWSpinLock::WriteHolder::operator=(), folly::RWSpinLock::UpgradedHolder::swap(), and folly::RWSpinLock::WriteHolder::swap().

373  {
374  std::swap(lock_, other->lock_);
375  }
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414

Friends And Related Function Documentation

friend class UpgradedHolder
friend

Definition at line 378 of file RWSpinLock.h.

Referenced by folly::RWSpinLock::UpgradedHolder::operator=().

friend class WriteHolder
friend

Definition at line 379 of file RWSpinLock.h.

Referenced by folly::RWSpinLock::WriteHolder::operator=().

Member Data Documentation


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