2.4.3.2 Setup — Zix 0.8.2 documentation

# 2.4.3.2 Setup

uint32_t zix_ring_capacity(const ZixRing *ring)

  Return the capacity (the total write space when empty).

  This function returns a constant for any given ring, and may (but usually shouldn’t) be called anywhere.

void zix_ring_free(ZixRing *ring)

  Destroy a ring.

  This frees the ring structure and its buffer, discarding its contents.

ZixStatus zix_ring_mlock(ZixRing *ring)

  Lock the ring data into physical memory.

  This function is NOT thread safe or real-time safe, but it should be called after `zix_ring_new()` to lock all ring memory to avoid page faults while using the ring.

ZixRing *zix_ring_new(ZixAllocator *allocator, uint32_t size)

  Create a new ring.

  Parameters:

    - allocator – Allocator for the ring object and its array.

    - size – Minimum size of the ring array in bytes. This must be between 2 and 2147483648 inclusive, and is rounded up to the next power of 2 internally. Note that one byte is reserved, so in order to be able to write `n` bytes to the ring at once, `size` must be `n + 1`.

void zix_ring_reset(ZixRing *ring)

  Reset (empty) a ring.

  This function is NOT thread-safe, it may only be called when there is no reader or writer.