C/C++ API Reference
Loading...
Searching...
No Matches
Interfaces

Oveview

Generic stream interfaces that support a combination of reading, writing, and seeking.

Submodules

 ReaderWriters
 Streams that support both reading and writing.
 
 Readers
 Streams that support reading but not writing.
 
 Writers
 Streams that support writing but not reading.
 

Classes

class  pw::stream::Stream
 

Functions

void pw::stream::CreateMpscStream (MpscReader &reader, MpscWriter &writer)
 
constexpr ptrdiff_t pw::stream::ResolveSeekOffset (ptrdiff_t offset, Stream::Whence origin, size_t end_position, size_t current_position)
 
constexpr Status pw::stream::CalculateSeek (ptrdiff_t offset, Stream::Whence origin, size_t end_position, size_t &current_position)
 

Function Documentation

◆ CreateMpscStream()

void pw::stream::CreateMpscStream ( MpscReader reader,
MpscWriter writer 
)

Creates a multi-producer, single consumer stream.

This method creates a stream by associating a reader and writer. Both are reset before being connected. This is the only way to connect a reader. Additional writers may be connected by copying the given writer after it is connected.

This method is thread-safe with respect to other MpscReader and MpscWriter methods. It is not thread-safe with respect to itself, i.e. callers must not make concurrent calls to CreateMpscStream() from different threads with the same objects.

Parameters
[out]readerThe reader to connect.
[out]writerThe writer to connect.