macro LFDS700_RINGBUFFER_GET_USER_STATE_FROM_STATE
Jump to navigation
Jump to search
Source File
└───liblfds700 └───inc └───liblfds700 lfds700_ringbuffer.h
Opaque Structures
struct lfds700_ringbuffer_state;
Macro
#define LFDS700_RINGBUFFER_GET_USER_STATE_FROM_STATE( ringbuffer_state )
Parameters
ringbuffer_state
- An initialized struct lfds700_ringbuffer_state. Not a pointer to it - the struct itself.
Return Value
Returns a void *, the user_state argument from lfds700_ringbuffer_init_valid_on_current_logical_core.
Notes
The user state value can only be set the once, when the data structure instance is initialized.
As with all liblfds macros, the macro operates on the structure itself, not a pointer to it.
Example
#include <stdio.h> #include "liblfds700.h" int main() { char ringbuffer_name[64] = "I Had a Dream, Joe"; struct lfds700_ringbuffer_element re_array[16]; struct lfds700_ringbuffer_state rs; void *user_state; lfds700_misc_library_init_valid_on_current_logical_core(); lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, 16, (void *) ringbuffer_name ); user_state = LFDS700_RINGBUFFER_GET_USER_STATE_FROM_STATE( rs ); printf( "ringbuffer name is \"%s\"\n", (char *) user_state ); lfds700_ringbuffer_cleanup( &rs, NULL ); lfds700_misc_library_cleanup(); return( EXIT_SUCCESS ); }