proxygen
folly::rcu_reader_domain< Tag > Class Template Reference

#include <Rcu.h>

Public Member Functions

FOLLY_ALWAYS_INLINE rcu_reader_domain (rcu_domain< Tag > *domain=rcu_default_domain()) noexcept
 
 rcu_reader_domain (std::defer_lock_t, rcu_domain< Tag > *domain=rcu_default_domain()) noexcept
 
 rcu_reader_domain (const rcu_reader_domain &)=delete
 
 rcu_reader_domain (rcu_reader_domain &&other) noexcept
 
rcu_reader_domainoperator= (const rcu_reader_domain &)=delete
 
rcu_reader_domainoperator= (rcu_reader_domain &&other) noexcept
 
FOLLY_ALWAYS_INLINE ~rcu_reader_domain () noexcept
 
void swap (rcu_reader_domain &other) noexcept
 
FOLLY_ALWAYS_INLINE void lock () noexcept
 
FOLLY_ALWAYS_INLINE void unlock () noexcept
 

Private Attributes

Optional< rcu_tokenepoch_
 
rcu_domain< Tag > * domain_
 

Detailed Description

template<typename Tag = RcuTag>
class folly::rcu_reader_domain< Tag >

Definition at line 391 of file Rcu.h.

Constructor & Destructor Documentation

template<typename Tag = RcuTag>
FOLLY_ALWAYS_INLINE folly::rcu_reader_domain< Tag >::rcu_reader_domain ( rcu_domain< Tag > *  domain = rcu_default_domain())
inlinenoexcept

Definition at line 393 of file Rcu.h.

395  : epoch_(domain->lock_shared()), domain_(domain) {}
Optional< rcu_token > epoch_
Definition: Rcu.h:436
rcu_domain< Tag > * domain_
Definition: Rcu.h:437
template<typename Tag = RcuTag>
folly::rcu_reader_domain< Tag >::rcu_reader_domain ( std::defer_lock_t  ,
rcu_domain< Tag > *  domain = rcu_default_domain() 
)
inlinenoexcept

Definition at line 396 of file Rcu.h.

399  : domain_(domain) {}
rcu_domain< Tag > * domain_
Definition: Rcu.h:437
template<typename Tag = RcuTag>
folly::rcu_reader_domain< Tag >::rcu_reader_domain ( const rcu_reader_domain< Tag > &  )
delete
template<typename Tag = RcuTag>
folly::rcu_reader_domain< Tag >::rcu_reader_domain ( rcu_reader_domain< Tag > &&  other)
inlinenoexcept

Definition at line 401 of file Rcu.h.

References folly::rcu_token::operator=().

402  : epoch_(std::move(other.epoch_)),
403  domain_(std::exchange(other.domain_, nullptr)) {}
Optional< rcu_token > epoch_
Definition: Rcu.h:436
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
rcu_domain< Tag > * domain_
Definition: Rcu.h:437
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
template<typename Tag = RcuTag>
FOLLY_ALWAYS_INLINE folly::rcu_reader_domain< Tag >::~rcu_reader_domain ( )
inlinenoexcept

Definition at line 414 of file Rcu.h.

References folly::rcu_token::epoch_, and folly::gen::move.

414  {
415  if (epoch_.has_value()) {
416  domain_->unlock_shared(std::move(epoch_.value()));
417  }
418  }
Optional< rcu_token > epoch_
Definition: Rcu.h:436
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
rcu_domain< Tag > * domain_
Definition: Rcu.h:437

Member Function Documentation

template<typename Tag = RcuTag>
FOLLY_ALWAYS_INLINE void folly::rcu_reader_domain< Tag >::lock ( )
inlinenoexcept

Definition at line 425 of file Rcu.h.

References folly::rcu_token::epoch_.

425  {
426  DCHECK(!epoch_.has_value());
427  epoch_ = domain_->lock_shared();
428  }
Optional< rcu_token > epoch_
Definition: Rcu.h:436
rcu_domain< Tag > * domain_
Definition: Rcu.h:437
template<typename Tag = RcuTag>
rcu_reader_domain& folly::rcu_reader_domain< Tag >::operator= ( const rcu_reader_domain< Tag > &  )
delete
template<typename Tag = RcuTag>
rcu_reader_domain& folly::rcu_reader_domain< Tag >::operator= ( rcu_reader_domain< Tag > &&  other)
inlinenoexcept

Definition at line 405 of file Rcu.h.

References folly::rcu_token::epoch_, and folly::gen::move.

405  {
406  if (epoch_.has_value()) {
407  domain_->unlock_shared(std::move(epoch_.value()));
408  }
409  epoch_ = std::move(other.epoch_);
410  domain_ = std::move(other.domain_);
411  return *this;
412  }
Optional< rcu_token > epoch_
Definition: Rcu.h:436
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
rcu_domain< Tag > * domain_
Definition: Rcu.h:437
template<typename Tag = RcuTag>
void folly::rcu_reader_domain< Tag >::swap ( rcu_reader_domain< Tag > &  other)
inlinenoexcept

Definition at line 420 of file Rcu.h.

References folly::rcu_token::epoch_, and folly::swap().

420  {
421  std::swap(epoch_, other.epoch_);
422  std::swap(domain_, other.domain_);
423  }
Optional< rcu_token > epoch_
Definition: Rcu.h:436
void swap(rcu_reader_domain< Tag > &a, rcu_reader_domain< Tag > &b) noexcept
Definition: Rcu.h:443
rcu_domain< Tag > * domain_
Definition: Rcu.h:437
template<typename Tag = RcuTag>
FOLLY_ALWAYS_INLINE void folly::rcu_reader_domain< Tag >::unlock ( )
inlinenoexcept

Definition at line 430 of file Rcu.h.

References folly::rcu_token::epoch_, and folly::gen::move.

430  {
431  DCHECK(epoch_.has_value());
432  domain_->unlock_shared(std::move(epoch_.value()));
433  }
Optional< rcu_token > epoch_
Definition: Rcu.h:436
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
rcu_domain< Tag > * domain_
Definition: Rcu.h:437

Member Data Documentation

template<typename Tag = RcuTag>
rcu_domain<Tag>* folly::rcu_reader_domain< Tag >::domain_
private

Definition at line 437 of file Rcu.h.

template<typename Tag = RcuTag>
Optional<rcu_token> folly::rcu_reader_domain< Tag >::epoch_
private

Definition at line 436 of file Rcu.h.


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