XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · VERSION 0.9.0 · BUILD FROM SOURCE
libxtos-rtxtos_spsc_pop

xtos_spsc_pop

Removes one frame and copies its metadata and samples into caller-provided output storage.

On this page

Declaration

c
#include <xtos/spsc.h>

int xtos_spsc_pop(struct xtos_spsc_queue *queue,
                  struct xtos_sample_frame *frame,
                  int32_t *samples_nv, size_t samples_capacity);

Parameters

ParameterTypeDescription
queuestruct xtos_spsc_queue *A non-NULL created queue.
framestruct xtos_sample_frame *Non-NULL output structure; on success its samples_nv points to samples_nv.
samples_nvint32_t *Non-NULL output array with at least samples_capacity elements.
samples_capacitysize_tOutput capacity in int32 elements, at least the queue channel count.

Return value

Returns 0 on success; returns -1 for an empty queue or invalid arguments.

Errors

errnoCondition
EINVALA pointer is NULL or samples_capacity is smaller than the queue channel count.
EAGAINNo frame is available; do not treat frame or the array as a new result.

Notes

  • Samples are copied into the caller array; reusing it invalidates the contents referenced by an earlier frame.samples_nv.
  • pop does not allocate and must have one consumer; an empty queue consumes nothing.

Example

Source

This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.