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

xtos_spsc_size

Returns the current difference between the queue head and tail.

On this page

Declaration

c
#include <xtos/spsc.h>

size_t xtos_spsc_size(const struct xtos_spsc_queue *queue);

Parameters

ParameterTypeDescription
queueconst struct xtos_spsc_queue *Queue pointer; NULL returns 0.

Return value

Returns the current estimated number of queued frames; returns 0 for NULL.

Errors

No errno error return. See Notes for input restrictions.

Notes

  • During concurrency this observes two atomics, not a reservation, synchronization barrier, or exact transaction; use push/pop results for operation decisions.
  • The function allocates no memory and does not change queue state.

Example

Source

This reference describes headers and implementation at OpenXTOS commit dd313955ad57542bcd2af8827157d1bbd0cf5e83.