2.4.3.2 Reading

Functions that may only be called by the read thread.

uint32_t zix_ring_peek(ZixRing *ring, void *dst, uint32_t size)

Read from the ring without advancing the read head.

Parameters:
  • ring – The ring to read data from.

  • dst – The buffer to write data to.

  • size – The number of bytes to read from ring and write to dst.

Returns:

The number of bytes read, which is either size on success, or zero on failure.

uint32_t zix_ring_read(ZixRing *ring, void *dst, uint32_t size)

Read from the ring and advance the read head.

Parameters:
  • ring – The ring to read data from.

  • dst – The buffer to write data to.

  • size – The number of bytes to read from ring and write to dst.

Returns:

The number of bytes read, which is either size on success, or zero on failure.

uint32_t zix_ring_read_space(const ZixRing *ring)

Return the number of bytes available for reading.

This function returns at most one less than the ring’s buffer size.

uint32_t zix_ring_skip(ZixRing *ring, uint32_t size)

Advance the read head, ignoring any data.

Returns:

Either size on success, or zero if there aren’t enough bytes to skip.