pbr-cpp-memory-pool 1.1.2
Fixed-block-size O(1) memory pool — C++17 with an ANSI C public surface
Loading...
Searching...
No Matches
it::d4np::memorypool::PoolObserver Struct Referenceabstract

Observer of pool-lifecycle events (the GoF Observer — ADR-0026). More...

#include <instrumented_pool.hpp>

Public Member Functions

 PoolObserver (const PoolObserver &)=default
 
 PoolObserver (PoolObserver &&)=default
 
PoolObserveroperator= (const PoolObserver &)=default
 
PoolObserveroperator= (PoolObserver &&)=default
 
virtual void on_pool_event (PoolEvent event, const PoolStats &stats) noexcept=0
 Called once per event, with a snapshot of the pool's counters.
 

Detailed Description

Observer of pool-lifecycle events (the GoF Observer — ADR-0026).

Register a concrete observer with InstrumentedPool::add_observer; it is notified on the calling thread. Notification is not internally synchronized (ADR-0026 §4) — register before concurrent use and make observers thread-safe, or observe single-threaded. The observer must out-live the InstrumentedPool it is attached to (the subject stores a non-owning pointer).

Definition at line 74 of file instrumented_pool.hpp.

Member Function Documentation

◆ on_pool_event()

virtual void it::d4np::memorypool::PoolObserver::on_pool_event ( PoolEvent  event,
const PoolStats stats 
)
pure virtualnoexcept

Called once per event, with a snapshot of the pool's counters.

noexcept by contract — an event handler must not throw (it may be invoked from the noexcept try_allocate and from the destructor); a throwing handler terminates, like a throwing destructor.


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