function lfds700_queue_init_valid_on_current_logical_core

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds700
    ├───inc
    │   └───liblfds700
    │           lfds700_queue.h
    └───src
        └───llfds700_queue
                lfds700_queue_init.c

Opaque Structures

struct lfds700_misc_prng_state;
struct lfds700_queue_element;
struct lfds700_queue_state;

Prototype

void lfds700_queue_init( struct lfds700_queue_state *qs,
                         struct lfds700_queue_element *qe_dummy,
                         struct lfds700_misc_prng_state *ps,
                         void *user_state );

Parameters

struct lfds700_queue_state *qs

A pointer to a user-allocated LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES aligned struct lfds700_queue_state. 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_queue_element *qe_dummy

A pointer to a user-allocated LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES aligned struct lfds700_queue_element. The queue data structure contains a single dummy element; this is that dummy 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.

void *user_state

A pointer to void, supplied by the user, which is returned to the user in various callback functions, permitting the user to pass his own state into those functions. This argument can be NULL.

Notes

As the function name indicates, the initialization work performed on the freelist state is only valid on the current logical core. To make this work valid on other logical cores, threads on other cores must call LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE.

The queue requires a single dummy element to function. This element is in fact used normally - it will emerge from the queue - and so it must be possible for the user to treat it, when it does emerge, as he would do any other element.

Example

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

See Also