TerminalRenderPublisher
Triple-buffered render cache publisher.
One buffer is writer-owned (back). One buffer is UI-readable (front). One buffer is spare (recycled after front is replaced).
Writer and UI never touch the same buffer simultaneously when UI consumers access the front buffer through readCurrent. Retired buffers release their image references after their last reader leaves; primitive row storage remains reusable for later publications.
The public inline reader avoids a callback allocation; non-inline operations own lease acquisition and release. Only cache-reference acquisition/release is part of the reader ABI; buffer layout, indices, locks and counters remain private.
Parameters
initial cache width in cells.
initial cache height in rows.
Functions
Pins the current cache, or returns null before the first publication.
Reads the latest published front buffer while preventing it from being recycled as a writer-owned back buffer.
Releases one successful acquireFrontLease using the identical cache reference.
Called from render worker thread only. Reads from reader, updates back buffer, publishes as new front.
Called from render worker thread only.