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

xtos_spsc_push

Copies one frame’s metadata and channels nanovolt samples into queue-owned storage.

On this page

Declaration

c
#include <xtos/spsc.h>

int xtos_spsc_push(struct xtos_spsc_queue *queue,
                   const struct xtos_sample_frame *frame);

Parameters

ParameterTypeDescription
queuestruct xtos_spsc_queue *A non-NULL created queue whose lifetime is guaranteed by the caller.
frameconst struct xtos_sample_frame *Non-NULL; channels must match the queue and timestamp_ns must be nonzero.

Return value

Returns 0 on success; returns -1 for a full queue or invalid arguments. The source frame and samples_nv may be reused after success.

Errors

errnoCondition
EINVALqueue, frame, or frame->samples_nv is NULL, channels do not match, or timestamp_ns is zero.
EAGAINThe queue is full; the new frame is rejected and existing frames are not overwritten.

Notes

  • The implementation checks the pointer but has no source length; samples_nv must expose at least queue channels readable int32 values.
  • This is a strict SPSC operation; atomic head/tail ordering is used, but there is no multi-producer or multi-consumer arbitration.
  • sequence, sample_rate_hz, and quality_flags receive no semantic or continuity validation.

Example

Source

This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.