chronon::sender::VersionedRegister
Lock-free ring buffer of (value, cycle) versions for lookahead-safe shared state. More...
#include <VersionedRegister.hpp>
Public Functions
| Name | |
|---|---|
| void | write(T value, uint64_t write_cycle) Caller must ensure write_cycle is non-decreasing across successive writes. |
| void | reset(T value =T{}) |
| T | readLatest() const Unfiltered latest read — use only when caller is known to be at the newest cycle. |
| T | read(uint64_t reader_cycle) const Returns the newest version with write_cycle <= reader_cycle, or oldest if skew exceeded. |
| VersionedRegister() =default | |
| VersionedRegister(T initial_value) |
Detailed Description
template <typename T ,
size_t HistoryDepth =16>
class chronon::sender::VersionedRegister;
Lock-free ring buffer of (value, cycle) versions for lookahead-safe shared state.
In parallel lookahead execution, units advance at different simulation cycles. A reader at cycle N must not observe writes made at cycle N+K. write() appends; read(cycle) returns the newest version with write_cycle <= reader_cycle. Single-writer/multi-reader safe via acquire/release on write_head_; multiple writers require external serialization.
Public Functions Documentation
function write
inline void write(
T value,
uint64_t write_cycle
)
Caller must ensure write_cycle is non-decreasing across successive writes.
function reset
inline void reset(
T value =T{}
)
function readLatest
inline T readLatest() const
Unfiltered latest read — use only when caller is known to be at the newest cycle.
function read
inline T read(
uint64_t reader_cycle
) const
Returns the newest version with write_cycle <= reader_cycle, or oldest if skew exceeded.
function VersionedRegister
VersionedRegister() =default
function VersionedRegister
inline explicit VersionedRegister(
T initial_value
)
Updated on 2026-05-26 at 05:42:32 +0000