function lfds711_ringbuffer_cleanup
Jump to navigation
Jump to search
Source Files
└───liblfds711 ├───inc │ └───liblfds711 │ lfds711_ringbuffer.h └───src └───lfds711_ringbuffer lfds711_ringbuffer_cleanup.c
Opaque Structures
struct lfds711_ringbuffer_state;
Prototype
void lfds711_ringbuffer_cleanup( struct lfds711_ringbuffer_state *rs, void (*element_cleanup_callback)(struct lfds711_ringbuffer_state *rs, void *key, void *value, void *user_state, enum lfds711_misc_flag unread_flag) );
Parameters
struct lfds711_ringbuffer_state *rs
- A pointer to an initialized struct lfds711_ringbuffer_state.
void (*element_cleanup_callback)(struct lfds711_ringbuffer_state *rs, void *key, void *value, void *user_state, enum lfds711_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 LFDS7110_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 LFDS711_RINGBUFFER_GET_USER_STATE_FROM_STATE macro on the stack state to get hold of the user state provided when the stack was initialized.