Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

API reference / Memory

IWriteSequentialMemory interface

The producer side of a sequential memory.

Use
import ThinkMeta.ConcurrentTasks.Memory.SequentialMemory;
Namespace
ThinkMeta::ConcurrentTasks::Memory

Syntax

Remarks

The stream is written front to back in blocks. Protocol: Initialize once with the expected total size, then for each block RequestWriteMemory, fill it, ReleaseWriteMemory; finally SetEndOfStream (also after an error, possibly without Initialize). Several blocks may be requested before the first is released; blocks are released in the order they were requested. A single producer: the members are not meant to be called concurrently. An implementation may suspend the calling task (e.g. to wait for room), so call them from a task.

See also

IReadSequentialMemory, SpscVirtualMemoryPipe

Methods

Initialize

Announces the stream's total size in bytes.

Syntax

virtual void Initialize(std::size_t initialSize) noexcept = 0;

Parameters

initialSizestd::size_t
Total number of bytes the producer will write; 0 for an empty stream.

Remarks

A hint for reserving memory.

RequestWriteMemory

Returns the next writable block.

Syntax

virtual std::byte* RequestWriteMemory(std::size_t size) noexcept = 0;

Parameters

sizestd::size_t
Number of bytes the block must hold.

Return value

Type: std::byte*

A block of size bytes that directly follows the previously requested one, or nullptr if no memory is available (out of memory, or the end of the data when the memory has a fixed capacity).

See also

ReleaseWriteMemory

ReleaseWriteMemory

Publishes written bytes to the consumer.

Syntax

virtual void ReleaseWriteMemory(std::size_t size) noexcept = 0;

Parameters

sizestd::size_t
Number of bytes written into the oldest unreleased block; at most its requested size, 0 allowed.

Remarks

Publishes the next size bytes of the requested blocks, i.e. the oldest requested block that is not released yet.

See also

RequestWriteMemory

SetEndOfStream

Marks the end of the stream.

Syntax

virtual void SetEndOfStream() noexcept = 0;

Remarks

No more data follows; wakes a waiting consumer.

Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).