hazptr_tc:
Declared in <folly/synchronization/HazptrThrLocal.h>
template<template<
typename,
typename,
typename> typename Atom = atomic>
class hazptr_tc;
Thread cache of hazptr_rec-s that belong to the default domain.
Uses a single dynamically-sized vector as the backing store. The hot paths (try_get, try_put) touch two cache lines for pure thread-local work with no atomics or contention: one for the vector metadata (data pointer, size, capacity) and count, and one for the actual entry being read or written.
A usage-aware decay mechanism gradually releases excess records (those beyond kCapacity) back to the domain when demand has subsided. Every kDecayThreshold fast-path puts when count exceeds kCapacity, the algorithm checks whether the excess was actively used during the window. If underutilized, both the record count and the allocation are shrunk, reclaiming memory. Active use (via try_put_slow) resets the tick counter and starts a new decay window.
| Name | Description |
|---|---|
hazptr_tc [constructor] | Constructors |
~hazptr_tc [destructor] | Evicts all cached records on destruction. |
operator= | Assignment operators |
allocated_capacity | Returns the allocated capacity of the backing store. |
count | Returns the number of records currently cached. |
| Name | Description |
|---|---|
min_capacity | Returns the minimum guaranteed capacity of the cache. |
| Name | Description |
|---|---|
folly::hazptr_tc_evict<Atom> | |
folly::hazptr_holder | hazptr_holder |
folly::hazptr_array | hazptr_array |
folly::hazptr_local | Grants hazptr_local access to the thread cache internals. |
| Name | Description |
|---|---|
hazptr_tc_tls | Access the thread-local hazard pointer cache. |