XTOS / OPEN SOURCE REAL-TIME SYSTEMOPEN SOURCE · 1.0.2 · PRERELEASE · IMAGES & 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 in OpenXTOS v1.0.2 (c24e923717670c4724cdaf24c7c105caee8dc2fb).