enum lfds710_ringbuffer_query

From liblfds.org
Revision as of 21:04, 7 May 2016 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source File

└───liblfds710
    └───inc
        └───liblfds710
                lfds710_ringbuffer.h

Enum

enum lfds710_ringbuffer_query
{
  LFDS710_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT,
  LFDS710_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE
};

Values

LFDS710_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT

Counts the number of unread elements in the ringbuffer. This query is and is only safe if performed single-threaded, i.e. that no read or write operations occur while the count operation is executing. If read or write operations occur, it is not merely the case that the count could be wrong - in theory, it could be possible for the count to enter an infinite loop. Don't do this.

LFDS710_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE

Validates the ringbuffer. This is done by checking there are no loops. Additionally, if given as input a lfds710_misc_validation_info, which indicates an expected range of the number of unread elements in the stack, counts the number of unread elements in the stack and checks they fall within the expected range. As with count, both the loop check and the element count (which is in fact performed by issuing the LFDS710_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT query) can in theory enter an infinite loop if push or pop operations occur while the validation operation is executing. You were warned.

Notes

This enum is used by the ringbuffer query function, lfds710_ringbuffer_query.

See Also