chronon::observe::ThreadContextManager
Singleton managing per-thread observability contexts. More...
#include <ThreadContextManager.hpp>
Public Functions
| Name | |
|---|---|
| bool | wakeBackend() Safe to call from any producer thread. |
| uint64_t | totalDroppedCount() const |
| void | setQueueCapacity(size_t capacity) PRECONDITION: must be called before any thread calls getContext(). |
| void | setBackpressurePolicy(BackpressurePolicy policy) PRECONDITION: must be called before any thread calls getContext(). |
| void | setBackpressurePolicy(ObservationChannel ch, BackpressurePolicy policy) |
| void | setBackpressureMaxSpins(uint32_t max_spins) |
| void | setBackpressureMaxSpins(ObservationChannel ch, uint32_t max_spins) |
| void | setBackendWakeup(void(*)(void *) fn, void * ctx) Register a callback the backend uses to be woken by producers. |
| size_t | queueCapacity() const |
| bool | isInitialized() const |
| ThreadContextManager & | instance() |
| ThreadContext * | getContext() Get or create the calling thread's context. |
| template <typename Fn > void | forEachContext(Fn && fn) Thread-safe; safe to call while other threads are using their contexts. |
| void | flushAll() Force-publish writer positions on all queues. Used during shutdown. |
| BackpressurePolicy | backpressurePolicy() const |
| BackpressurePolicy | backpressurePolicy(ObservationChannel ch) const |
| uint32_t | backpressureMaxSpins() const |
| uint32_t | backpressureMaxSpins(ObservationChannel ch) const |
| size_t | activeThreadCount() const |
Public Attributes
| Name | |
|---|---|
| size_t | MAX_THREADS |
Detailed Description
class chronon::observe::ThreadContextManager;
Singleton managing per-thread observability contexts.
Pre-allocated context pool, thread-local pointer cache, lock-free hot path.
Public Functions Documentation
function wakeBackend
inline bool wakeBackend()
Safe to call from any producer thread.
function totalDroppedCount
inline uint64_t totalDroppedCount() const
function setQueueCapacity
inline void setQueueCapacity(
size_t capacity
)
PRECONDITION: must be called before any thread calls getContext().
function setBackpressurePolicy
inline void setBackpressurePolicy(
BackpressurePolicy policy
)
PRECONDITION: must be called before any thread calls getContext().
function setBackpressurePolicy
inline void setBackpressurePolicy(
ObservationChannel ch,
BackpressurePolicy policy
)
function setBackpressureMaxSpins
inline void setBackpressureMaxSpins(
uint32_t max_spins
)
function setBackpressureMaxSpins
inline void setBackpressureMaxSpins(
ObservationChannel ch,
uint32_t max_spins
)
function setBackendWakeup
inline void setBackendWakeup(
void(*)(void *) fn,
void * ctx
)
Register a callback the backend uses to be woken by producers.
Indirected through atomics to avoid a circular header dependency. Written once at startup, read on hot path — acquire/release suffices.
function queueCapacity
inline size_t queueCapacity() const
function isInitialized
inline bool isInitialized() const
function instance
static inline ThreadContextManager & instance()
function getContext
inline ThreadContext * getContext()
Get or create the calling thread's context.
Return: Thread context, or nullptr if MAX_THREADS exceeded.
function forEachContext
template <typename Fn >
inline void forEachContext(
Fn && fn
)
Thread-safe; safe to call while other threads are using their contexts.
function flushAll
inline void flushAll()
Force-publish writer positions on all queues. Used during shutdown.
function backpressurePolicy
inline BackpressurePolicy backpressurePolicy() const
function backpressurePolicy
inline BackpressurePolicy backpressurePolicy(
ObservationChannel ch
) const
function backpressureMaxSpins
inline uint32_t backpressureMaxSpins() const
function backpressureMaxSpins
inline uint32_t backpressureMaxSpins(
ObservationChannel ch
) const
function activeThreadCount
inline size_t activeThreadCount() const
Public Attributes Documentation
variable MAX_THREADS
static size_t MAX_THREADS = 64;
Updated on 2026-05-26 at 05:42:33 +0000