function lfds700_queue_enqueue

From liblfds.org
Revision as of 02:09, 31 December 2015 by Admin (talk | contribs) (→‎Parameters)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source Files

└───liblfds700
    ├───inc
    │   └───liblfds700
    │           lfds700_queue.h
    └───src
        └───lfds700_queue
                lfds700_queue_enqueue.c

Opaque Structures

struct lfds700_misc_prng_state;
struct lfds700_queue_element;
struct lfds700_queue_state;

Prototype

void lfds700_queue_enqueue( struct lfds700_queue_state *qs,
                            struct lfds700_queue_element *qe,
                            struct lfds700_misc_prng_state *ps );

Parameters

struct lfds700_queue_state *qs

A pointer to an initialized struct lfds700_queue_state.

struct lfds700_queue_state *qe

A pointer to a user-allocated LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES aligned struct lfds700_queue_element. Stack declared variables will automatically be correctly aligned by the compiler, due to the information in the structure definitions; nothing has to be done. Heap allocated variables however will by no means be correctly aligned and an aligned malloc must be used.

struct lfds700_misc_prng_state *ps

A pointer to an initialized struct lfds700_misc_prng_state.

Notes

This function enqueues a queue element, with its key and value, onto the queue. The key and value are both optional, are set by the macros LFDS700_QUEUE_SET_KEY_IN_ELEMENT and LFDS700_QUEUE_SET_VALUE_IN_ELEMENT respectively, and can only be set when a queue element is outside of a queue.

The third argument, the struct lfds700_misc_prng_state, is the state for a single-threaded, fast, high quality random number generator, required by the exponential backoff code. Each thread should allocate and initialize one of these structures, and then it can be used for all API calls which take this argument.

Example

Coming soon. No, really! (Written 29th Dec 2015).

See Also