enum lfds711_queue_umm_query

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_queue_umm.h

Enum

enum lfds711_queue_umm_query
{
  LFDS711_QUEUE_UMM_QUERY_SINGLETHREADED_GET_COUNT,
  LFDS711_QUEUE_UMM_QUERY_SINGLETHREADED_VALIDATE
};

Values

LFDS711_QUEUE_UMM_QUERY_SINGLETHREADED_GET_COUNT

Counts the number of elements in the queue. This query is and is only safe if performed single-threaded, i.e. that no enqueue or dequeue operations occur while the count operation is executing. If enqueue or dequeue 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, or, if a dequeued element was enqueued into another queue, to continue counting in that second queue. Don't do this.

LFDS711_QUEUE_UMM_QUERY_SINGLETHREADED_VALIDATE

Validates the queue. This is done by checking there are no loops. Additionally, if given as input a lfds711_misc_validation_info, which indicates an expected range of the number of elements in the queue, counts the number of elements in the queue 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 LFDS711_QUEUE_UMM_QUERY_SINGLETHREADED_GET_COUNT query) can in theory enter an infinite loop if enqueue or dequeue operations occur while the validation operation is executing. You were warned.

Notes

This enum is used by the queue query function, lfds711_queue_umm_query.

See Also