This class creates core‐local caches for a given shared_ptr, to mitigate contention when acquiring/releasing it.

Synopsis

Declared in <folly/concurrency/CoreCachedSharedPtr.h>

template<
    class T,
    size_t kMaxSlots = kCoreCachedSharedPtrDefaultMaxSlots>
class CoreCachedSharedPtr;

Description

It has the same thread‐safety guarantees as shared_ptr: it is safe to concurrently call get(), but reset()s must be synchronized with reads and other reset()s.

Member Functions

Name

Description

CoreCachedSharedPtr [constructor]

Constructors

get

Returns the shared pointer cached for the current core.

reset

Replaces the held pointer, repopulating the core‐local caches.

Friends

Name

Description

folly::CoreCachedWeakPtr

Core‐local cache of weak pointers to a shared object.

Created with MrDocs