proxygen
folly::ReadMostlyMainPtrDeleter< RefCount > Class Template Reference

#include <ReadMostlySharedPtr.h>

Public Member Functions

 ~ReadMostlyMainPtrDeleter () noexcept
 
template<typename T >
void add (ReadMostlyMainPtr< T, RefCount > ptr) noexcept
 

Private Attributes

std::vector< RefCount * > refCounts_
 
std::vector< folly::Function< void()> > decrefs_
 

Detailed Description

template<typename RefCount = DefaultRefCount>
class folly::ReadMostlyMainPtrDeleter< RefCount >

This can be used to destroy multiple ReadMostlyMainPtrs at once.

Definition at line 32 of file ReadMostlySharedPtr.h.

Constructor & Destructor Documentation

template<typename RefCount = DefaultRefCount>
folly::ReadMostlyMainPtrDeleter< RefCount >::~ReadMostlyMainPtrDeleter ( )
inlinenoexcept

Definition at line 372 of file ReadMostlySharedPtr.h.

References folly::detail::ReadMostlySharedPtrCore< T, RefCount >::decref().

372  {
373  RefCount::useGlobal(refCounts_);
374  for (auto& decref : decrefs_) {
375  decref();
376  }
377  }
std::vector< folly::Function< void()> > decrefs_
std::vector< RefCount * > refCounts_

Member Function Documentation

template<typename RefCount = DefaultRefCount>
template<typename T >
void folly::ReadMostlyMainPtrDeleter< RefCount >::add ( ReadMostlyMainPtr< T, RefCount >  ptr)
inlinenoexcept

Definition at line 380 of file ReadMostlySharedPtr.h.

References ptr.

Referenced by folly::detail::SingletonHolder< T >::preDestroyInstance(), and TEST_F().

380  {
381  if (!ptr.impl_) {
382  return;
383  }
384 
385  refCounts_.push_back(&ptr.impl_->count_);
386  refCounts_.push_back(&ptr.impl_->weakCount_);
387  decrefs_.push_back([impl = ptr.impl_] { impl->decref(); });
388  ptr.impl_ = nullptr;
389  }
void * ptr
std::vector< folly::Function< void()> > decrefs_
std::vector< RefCount * > refCounts_

Member Data Documentation

template<typename RefCount = DefaultRefCount>
std::vector<folly::Function<void()> > folly::ReadMostlyMainPtrDeleter< RefCount >::decrefs_
private

Definition at line 393 of file ReadMostlySharedPtr.h.

template<typename RefCount = DefaultRefCount>
std::vector<RefCount*> folly::ReadMostlyMainPtrDeleter< RefCount >::refCounts_
private

Definition at line 392 of file ReadMostlySharedPtr.h.


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