xtos_ spsc_ pop
Removes one frame and copies its metadata and samples into caller-provided output storage.
On this page
Declaration
#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
| Parameter | Type | Description |
|---|---|---|
| queue | struct xtos_spsc_queue * | A non-NULL created queue. |
| frame | struct xtos_sample_frame * | Non-NULL output structure; on success its samples_nv points to samples_nv. |
| samples_nv | int32_t * | Non-NULL output array with at least samples_capacity elements. |
| samples_capacity | size_t | Output 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
| errno | Condition |
|---|---|
| EINVAL | A pointer is NULL or samples_capacity is smaller than the queue channel count. |
| EAGAIN | No 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.