r6.1.1:lfds611_slist_new
Jump to navigation
Jump to search
Source Files
/liblfds611/src/lfds611_slist/lfds611_slist_new.c /liblfds611/inc/liblfds611.h
Prototype
int lfds611_slist_new( struct lfds611_slist_state **ss, void (*user_data_delete_function)(void *user_data, void *user_state), void *user_state );
Parameters
struct lfds611_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 lfds611_slist_use. The values of user_data_delete_function and user_state are stored in the slist state for later use by lfds611_slist_delete, lfds611_slist_delete_element and lfds611_slist_delete_all_elements.