proxygen
folly::RWSpinLock::WriteHolder Class Reference

#include <RWSpinLock.h>

Public Member Functions

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

Private Attributes

RWSpinLocklock_
 

Friends

class ReadHolder
 
class UpgradedHolder
 

Detailed Description

Definition at line 446 of file RWSpinLock.h.

Constructor & Destructor Documentation

folly::RWSpinLock::WriteHolder::WriteHolder ( RWSpinLock lock)
inlineexplicit

Definition at line 448 of file RWSpinLock.h.

References folly::RWSpinLock::lock(), and folly::RWSpinLock::ReadHolder::lock_.

448  : lock_(lock) {
449  if (lock_) {
450  lock_->lock();
451  }
452  }
folly::RWSpinLock::WriteHolder::WriteHolder ( RWSpinLock lock)
inlineexplicit

Definition at line 454 of file RWSpinLock.h.

References folly::RWSpinLock::lock(), and folly::RWSpinLock::ReadHolder::lock_.

454  : lock_(&lock) {
455  lock_->lock();
456  }
folly::RWSpinLock::WriteHolder::WriteHolder ( UpgradedHolder &&  upgraded)
inlineexplicit

Definition at line 459 of file RWSpinLock.h.

References folly::RWSpinLock::ReadHolder::lock_, and folly::RWSpinLock::unlock_upgrade_and_lock().

459  {
460  lock_ = upgraded.lock_;
461  upgraded.lock_ = nullptr;
462  if (lock_) {
464  }
465  }
void unlock_upgrade_and_lock()
Definition: RWSpinLock.h:241
folly::RWSpinLock::WriteHolder::WriteHolder ( WriteHolder &&  other)
inlinenoexcept

Definition at line 467 of file RWSpinLock.h.

467  : lock_(other.lock_) {
468  other.lock_ = nullptr;
469  }
folly::RWSpinLock::WriteHolder::WriteHolder ( const WriteHolder other)
delete
folly::RWSpinLock::WriteHolder::~WriteHolder ( )
inline

Definition at line 480 of file RWSpinLock.h.

References folly::RWSpinLock::ReadHolder::lock_, and folly::RWSpinLock::unlock().

480  {
481  if (lock_) {
482  lock_->unlock();
483  }
484  }

Member Function Documentation

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

Definition at line 471 of file RWSpinLock.h.

References folly::RWSpinLock::ReadHolder::lock_, folly::RWSpinLock::ReadHolder::operator=(), folly::RWSpinLock::ReadHolder::swap(), folly::f14::swap(), and folly::RWSpinLock::ReadHolder::WriteHolder.

471  {
472  using std::swap;
473  swap(lock_, other.lock_);
474  return *this;
475  }
void swap(WriteHolder *other)
Definition: RWSpinLock.h:499
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414
WriteHolder& folly::RWSpinLock::WriteHolder::operator= ( const WriteHolder other)
delete
void folly::RWSpinLock::WriteHolder::reset ( RWSpinLock lock = nullptr)
inline

Definition at line 486 of file RWSpinLock.h.

References folly::RWSpinLock::lock(), folly::RWSpinLock::ReadHolder::lock_, and folly::RWSpinLock::unlock().

486  {
487  if (lock == lock_) {
488  return;
489  }
490  if (lock_) {
491  lock_->unlock();
492  }
493  lock_ = lock;
494  if (lock_) {
495  lock_->lock();
496  }
497  }
void folly::RWSpinLock::WriteHolder::swap ( WriteHolder other)
inline

Definition at line 499 of file RWSpinLock.h.

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

499  {
500  using std::swap;
501  swap(lock_, other->lock_);
502  }
void swap(WriteHolder *other)
Definition: RWSpinLock.h:499
void swap(SwapTrackingAlloc< T > &, SwapTrackingAlloc< T > &)
Definition: F14TestUtil.h:414

Friends And Related Function Documentation

friend class ReadHolder
friend

Definition at line 505 of file RWSpinLock.h.

friend class UpgradedHolder
friend

Definition at line 506 of file RWSpinLock.h.

Member Data Documentation

RWSpinLock* folly::RWSpinLock::WriteHolder::lock_
private

Definition at line 507 of file RWSpinLock.h.

Referenced by swap().


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