function lfds710_queue_bss_enqueue

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds710
    ├───inc
    │   └───liblfds710
    │           lfds710_queue_bounded_singleproducer_singleconsumer.h
    └───src
        └───lfds710_queue_bounded_singleproducer_singleconsumer
                lfds710_queue_bounded_singleproducer_singleconsumer_enqueue.c

Opaque Structures

struct lfds710_queue_bss_state;

Prototype

void lfds710_queue_bss_enqueue( struct lfds710_queue_bss_state *qbsss, void *key, void *value );

Parameters

struct lfds710_queue_bss_state *qbsss

A pointer to an initialized struct lfds710_queue_bss_state.

void *key

A void pointer, which the key in the queue element is set to. This argument can be NULL, and the actual value of the key is not used in any way by the queue.

void *value

A void pointer, which the value in the queue element is set to. This argument can be NULL, and the actual value of the value is not used in any way by the queue.

Return Value

Returns 1 on a successful enqueue. Returns 0 if enqueing failed. Enqueuing only fails if the queue is full.

Notes

This function takes a user-provided void pointer (which typically points to user allocated store, but could of course be used directly) and enqueues it into the queue.

Unlike all the other data structures in liblfds, there is with this queue no guarantee that enqueued elements are ever seen by the consumer thread. In practise, they are, and in a very short time - fifty microseconds or whatever it may be; but, unlike the other data structures, there is then on guarantee of visibility simply because the enqueue function has returned.

See Also