function lfds710_ringbuffer_cleanup

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds710
    ├───inc
    │   └───liblfds710
    │           lfds710_ringbuffer.h
    └───src
        └───lfds710_ringbuffer
                lfds710_ringbuffer_cleanup.c

Opaque Structures

struct lfds710_ringbuffer_state;

Prototype

void lfds710_ringbuffer_cleanup( struct lfds710_ringbuffer_state *rs,
                                 void (*element_cleanup_callback)(struct lfds710_ringbuffer_state *rs, void *key, void *value, void *user_state, enum lfds710_misc_flag unread_flag) );

Parameters

struct lfds710_ringbuffer_state *rs

A pointer to an initialized struct lfds710_ringbuffer_state.

void (*element_cleanup_callback)(struct lfds710_ringbuffer_state *rs, void *key, void *value, void *user_state, enum lfds710_misc_flag unread_flag)

A callback function which is called with every element present in the ringbuffer at the time of cleanup. This argument can be NULL. If the key/value pair come from an element which has been written, but not yet read, the argument unread_flag is set to LFDS7100_MISC_RAISED.

Notes

The cleanup function actually does no work except, if the callback function is provided, to iterate over the ringbuffer and pass each element (read or unread, with an argument to the callback function indicating read/unread state) to the callback function.

The user can in the callback function use the LFDS710_RINGBUFFER_GET_USER_STATE_FROM_STATE macro on the stack state to get hold of the user state provided when the stack was initialized.

See Also