function lfds711_queue_bmm_query

From liblfds.org
Jump to: navigation, search

Source Files

└───liblfds711
    ├───inc
    │   └───liblfds711
    │           lfds711_queue_bmm.h
    └───src
        └───lfds711_queue
                lfds711_queue_bmm_query.c

Enums

enum lfds711_queue_bmm_query
{
  LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT,
  LFDS711_QUEUE_BMM_QUERY_SINGLETHREADED_VALIDATE
};

Opaque Structures

struct lfds711_queue_bmm_state;

Prototype

void lfds711_queue_bmm_query( struct lfds711_queue_bmm_state *qbmms,
                              enum lfds711_queue_bmm_query query_type,
                              void *query_input,
                              void *query_output );

Parameters

struct lfds711_queue_umm_state *qbmms

A pointer to an initialized struct lfds711_queue_bmm_state.

enum lfds711_queue_bmm_query query_type

Indicates which query to perform.

void *query_input

A pointer to data, or data cast to a void pointer, which is input data required by query indicated by query_type.

void *query_output

A pointer to store into which the requested information is placed, where the output data varies by the query indicted by query_type.

Queries

void *query_input

A pointer to input data for the query, where the data varies by query;
LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT
query_input is NULL.
LFDS711_QUEUE_BMM_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 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_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT
Points to a lfds711_pal_uint_t, which is set to the number of elements in the queue.
LFDS711_QUEUE_BMM_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 enqueue or dequeue operations occur while the operation runs. If enqueue or dequeue 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.

The LFDS711_QUEUE_BMM_QUERY_GET_POTENTIALLY_INACCURATE_COUNT query is not guaranteed to be accurate. Where enqueue and dequeue operations are not guaranteed to be visible by the time the function calls return, similarly, it may be that a count will during its operation not see an element which has been enqueued, or see that an element has been dequeued. In general however it should be bang on; it's just it's not guaranteed.

See Also