function lfds711_ringbuffer_query

From liblfds.org
Revision as of 18:12, 16 February 2017 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

└───liblfds711
    ├───inc
    │   └───liblfds711
    │           lfds711_ringbuffer.h
    └───src
        └───lfds711_ringbuffer
                lfds711_ringbuffer_query.c

Enums

enum lfds711_ringbuffer_query
{
  LFDS711_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT,
  LFDS711_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE
};

Opaque Structures

struct lfds711_ringbuffer_state;

Prototype

void lfds711_ringbuffer_query( struct lfds711_ringbuffer_state *rs,
                               enum lfds711_ringbuffer_query query_type,
                               void *query_input,
                               void *query_output );

Parameters

struct lfds711_ringbuffer_state *rs

A pointer to an initialized struct lfds711_ringbuffer_state.

enum lfds711_ringbuffer_query query_type

An enum lfds711_ringbuffer_query, which indicates which query to perform.

void *query_input

A pointer to input data for the query, where the data varies by query;
LFDS711_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT
query_input is NULL.
LFDS711_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE
query_input can be NULL, or or can be a pointer to a struct lfds711_misc_validation_info, which specifies an expected min/max count, in which case validation also counts the number of unread elements and check they fall within the specified range.

void *query_output

A pointer to output store for the query, where the output varies by query;
LFDS711_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT
Points to a lfds711_pal_uint_t, which is set to the number of unread elements in the ringbuffer.
LFDS711_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE
Points to an enum lfds711_misc_validity, which is set to indicate the result of the validation operation.

Notes

All SINGLETHREADED queries can only be safely performed if no read or write operations occur while the operation runs. If read or write operations do occur during the execution of a SINGLETHREADED query, it is theoretically possible for the query to enter an infinite loop. Do not do this.

See Also