r6.1.0:lfds610_slist_new

From liblfds.org
Jump to navigation Jump to search

Source Files

/liblfds610/src/lfds610_slist/lfds610_slist_new.c
/liblfds610/inc/liblfds610.h

Prototype

int lfds610_slist_new( struct lfds610_slist_state **ss,
                     void (*user_data_delete_function)(void *user_data, void *user_state),
                     void *user_state );

Parameters

struct lfds610_slist_state **ss

A pointer to a pointer onto which is allocated the state which represents an slist. Set to NULL if slist creation fails.

void (*user_data_delete_function)(void *user_data, void *user_state)

A callback function, which can be NULL. This function is called with the user data void pointer from each element after that element is logically deleted, giving the user an opportunity to delete any allocated state.

void *user_state

This is passed to each call of user_data_delete_function as the second argument to that function. The user is expected to use this to pass state information into his delete function.

Return Value

Returns 1 on successful list creation, 0 otherwise. On failure, *ss will also be set to NULL.

Notes

This function instantiates a slist. After instantiation any thread (except the instantiating thread) must before using the slist first call lfds610_slist_use. The values of user_data_delete_function and user_state are stored in the slist state for later use by lfds610_slist_delete, lfds610_slist_delete_element and lfds610_slist_delete_all_elements.

See Also