function lfds710_list_asu_insert_at_position

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds710
    ├───inc
    │   └───liblfds710
    │           lfds710_list_addonly_singlylinked_unordered.h
    └───src
        └───llfds710_list_addonly_singlylinked_unordered
                lfds710_list_addonly_singlylinked_unordered_insert.c

Opaque Structures

struct lfds710_list_asu_element;
struct lfds710_list_asu_state;

Prototype

void lfds710_list_asu_insert_at_position( struct lfds710_list_asu_state *lasus,
                                          struct lfds710_list_asu_element *lasue,
                                          struct lfds710_list_asu_element *lasue_predecessor,
                                          enum lfds710_list_asu_position position );

Parameters

struct lfds710_list_asu_state *lasus

A pointer to an initialized struct lfds710_list_asu_state.

struct lfds710_list_asu_element *lasue

A pointer a user-allocated LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES aligned struct lfds710_list_asu_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 lfds710_list_asu_element *lasue_predecessor

A pointer an element already in the list. This argument is only used if position is set to LFDS710_LIST_ASU_POSITION_AFTER.

enum lfds710_list_asu_position position

Indictes which position to insert*lasue at.

Notes

This is a convenience function which wraps the functionality provided by lfds710_list_asu_insert_at_start, lfds710_list_asu_insert_at_end and lfds710_list_asu_insert_after into a single function where the desired behaviour is selected by means of the position argument.

So rather than having in your code to select which function to call, you can just select which enum value to use.

See Also