proxygen
|
#include <ThreadLocalDetail.h>
Classes | |
class | EntryID |
Public Member Functions | |
StaticMetaBase (ThreadEntry *(*threadEntry)(), bool strict) | |
void | push_back (ThreadEntry *t) |
void | erase (ThreadEntry *t) |
uint32_t | elementsCapacity () const |
uint32_t | allocate (EntryID *ent) |
void | destroy (EntryID *ent) |
void | reserve (EntryID *id) |
ElementWrapper & | getElement (EntryID *ent) |
void | reserveHeadUnlocked (uint32_t id) |
void | pushBackLocked (ThreadEntry *t, uint32_t id) |
void | pushBackUnlocked (ThreadEntry *t, uint32_t id) |
Static Public Member Functions | |
static FOLLY_EXPORT ThreadEntryList * | getThreadEntryList () |
static void | onThreadExit (void *ptr) |
static ElementWrapper * | reallocate (ThreadEntry *threadEntry, uint32_t idval, size_t &newCapacity) |
Public Attributes | |
uint32_t | nextId_ |
std::vector< uint32_t > | freeIds_ |
std::mutex | lock_ |
SharedMutex | accessAllThreadsLock_ |
pthread_key_t | pthreadKey_ |
ThreadEntry | head_ |
ThreadEntry *(* | threadEntry_ )() |
bool | strict_ |
Protected Member Functions | |
~StaticMetaBase () | |
Definition at line 299 of file ThreadLocalDetail.h.
folly::threadlocal_detail::StaticMetaBase::StaticMetaBase | ( | ThreadEntry *(*)() | threadEntry, |
bool | strict | ||
) |
Definition at line 67 of file ThreadLocalDetail.cpp.
References folly::checkPosixError(), head_, folly::threadlocal_detail::ThreadEntry::next, onThreadExit(), folly::threadlocal_detail::ThreadEntry::prev, pthreadKey_, and folly::threadlocal_detail::PthreadKeyUnregister::registerKey().
|
inlineprotected |
Definition at line 403 of file ThreadLocalDetail.h.
Definition at line 217 of file ThreadLocalDetail.cpp.
References g(), folly::threadlocal_detail::kEntryIDInvalid, reserveHeadUnlocked(), uint32_t, and folly::threadlocal_detail::StaticMetaBase::EntryID::value.
Referenced by folly::threadlocal_detail::StaticMetaBase::EntryID::getOrAllocate().
void folly::threadlocal_detail::StaticMetaBase::destroy | ( | EntryID * | ent | ) |
Definition at line 242 of file ThreadLocalDetail.cpp.
References folly::ALL_THREADS, folly::threadlocal_detail::ElementWrapper::deleter1, folly::threadlocal_detail::ThreadEntry::elements, elementsCapacity(), g(), folly::threadlocal_detail::ThreadEntry::getElementsCapacity(), folly::threadlocal_detail::kEntryIDInvalid, cpp.ast::next(), folly::threadlocal_detail::ElementWrapper::ownsDeleter, ptr, folly::threadlocal_detail::ElementWrapper::ptr, uint32_t, folly::threadlocal_detail::StaticMetaBase::EntryID::value, folly::WARNING, and folly::wlock().
uint32_t folly::threadlocal_detail::StaticMetaBase::elementsCapacity | ( | ) | const |
Definition at line 211 of file ThreadLocalDetail.cpp.
References FOLLY_LIKELY, and folly::threadlocal_detail::ThreadEntry::getElementsCapacity().
Referenced by destroy(), and onThreadExit().
|
inline |
Definition at line 351 of file ThreadLocalDetail.h.
References destroy(), FOLLY_EXPORT, folly::threadlocal_detail::ThreadEntry::next, folly::threadlocal_detail::ThreadEntry::prev, ptr, folly::reserve, folly::pushmi::detail::t, and uint32_t.
ElementWrapper& folly::threadlocal_detail::StaticMetaBase::getElement | ( | EntryID * | ent | ) |
|
static |
Definition at line 75 of file ThreadLocalDetail.cpp.
References folly::checkPosixError(), FOLLY_ALWAYS_INLINE, pthreadKey_, folly::threadlocal_detail::PthreadKeyUnregister::registerKey(), and UNLIKELY.
|
static |
Definition at line 111 of file ThreadLocalDetail.cpp.
References elementsCapacity(), FOR_EACH_RANGE, bm::free(), g(), i, folly::threadlocal_detail::ThreadEntry::meta, ptr, folly::rlock(), and folly::THIS_THREAD.
Referenced by StaticMetaBase().
|
inline |
Definition at line 344 of file ThreadLocalDetail.h.
References folly::threadlocal_detail::ThreadEntry::next, folly::threadlocal_detail::ThreadEntry::prev, and folly::pushmi::detail::t.
void folly::threadlocal_detail::StaticMetaBase::pushBackLocked | ( | ThreadEntry * | t, |
uint32_t | id | ||
) |
Definition at line 452 of file ThreadLocalDetail.cpp.
References folly::threadlocal_detail::ThreadEntry::elements, g(), head_, LIKELY, lock_, folly::threadlocal_detail::ElementWrapper::node, folly::threadlocal_detail::ThreadEntryNode::push_back(), and folly::threadlocal_detail::ThreadEntry::removed_.
Referenced by folly::threadlocal_detail::ThreadEntryNode::initIfZero().
void folly::threadlocal_detail::StaticMetaBase::pushBackUnlocked | ( | ThreadEntry * | t, |
uint32_t | id | ||
) |
Definition at line 460 of file ThreadLocalDetail.cpp.
References folly::threadlocal_detail::ThreadEntry::elements, FOLLY_STATIC_CTOR_PRIORITY_MAX, head_, folly::threadlocal_detail::PthreadKeyUnregister::instance_, LIKELY, folly::threadlocal_detail::ElementWrapper::node, folly::threadlocal_detail::ThreadEntryNode::push_back(), and folly::threadlocal_detail::ThreadEntry::removed_.
Referenced by folly::threadlocal_detail::ThreadEntryNode::initIfZero().
|
static |
Definition at line 309 of file ThreadLocalDetail.cpp.
References folly::threadlocal_detail::ThreadEntry::elements, folly::threadlocal_detail::ThreadEntry::getElementsCapacity(), head_, folly::jemallocMinInPlaceExpandable, kBigGrowthFactor, kSmallGrowthFactor, mallocx, MALLOCX_ZERO, folly::threadlocal_detail::ThreadEntry::meta, nallocx, folly::detail::success, folly::usingJEMalloc(), and xallocx.
Referenced by reserve(), and reserveHeadUnlocked().
void folly::threadlocal_detail::StaticMetaBase::reserve | ( | EntryID * | id | ) |
Reserve enough space in the ThreadEntry::elements for the item to fit in.
Definition at line 382 of file ThreadLocalDetail.cpp.
References folly::threadlocal_detail::ThreadEntry::elements, bm::free(), g(), folly::threadlocal_detail::ThreadEntry::getElementsCapacity(), i, folly::threadlocal_detail::ThreadEntryNode::initZero(), folly::threadlocal_detail::ElementWrapper::node, reallocate(), folly::threadlocal_detail::ThreadEntry::setElementsCapacity(), folly::f14::swap(), and uint32_t.
void folly::threadlocal_detail::StaticMetaBase::reserveHeadUnlocked | ( | uint32_t | id | ) |
Definition at line 429 of file ThreadLocalDetail.cpp.
References folly::threadlocal_detail::ThreadEntry::elements, bm::free(), folly::threadlocal_detail::ThreadEntry::getElementsCapacity(), head_, i, folly::threadlocal_detail::ThreadEntryNode::init(), folly::threadlocal_detail::ElementWrapper::node, reallocate(), folly::threadlocal_detail::ThreadEntry::setElementsCapacity(), and folly::f14::swap().
Referenced by allocate().
SharedMutex folly::threadlocal_detail::StaticMetaBase::accessAllThreadsLock_ |
Definition at line 396 of file ThreadLocalDetail.h.
std::vector<uint32_t> folly::threadlocal_detail::StaticMetaBase::freeIds_ |
Definition at line 394 of file ThreadLocalDetail.h.
ThreadEntry folly::threadlocal_detail::StaticMetaBase::head_ |
Definition at line 398 of file ThreadLocalDetail.h.
Referenced by folly::ThreadLocalPtr< T, Tag, AccessMode >::Accessor::Iterator::decrementToValid(), folly::ThreadLocalPtr< T, Tag, AccessMode >::Accessor::Iterator::incrementToValid(), pushBackLocked(), pushBackUnlocked(), reallocate(), reserveHeadUnlocked(), and StaticMetaBase().
std::mutex folly::threadlocal_detail::StaticMetaBase::lock_ |
Definition at line 395 of file ThreadLocalDetail.h.
Referenced by pushBackLocked().
uint32_t folly::threadlocal_detail::StaticMetaBase::nextId_ |
Definition at line 393 of file ThreadLocalDetail.h.
pthread_key_t folly::threadlocal_detail::StaticMetaBase::pthreadKey_ |
Definition at line 397 of file ThreadLocalDetail.h.
Referenced by getThreadEntryList(), and StaticMetaBase().
bool folly::threadlocal_detail::StaticMetaBase::strict_ |
Definition at line 400 of file ThreadLocalDetail.h.
ThreadEntry*(* folly::threadlocal_detail::StaticMetaBase::threadEntry_) () |
Definition at line 399 of file ThreadLocalDetail.h.