macro LFDS700_QUEUE_BSS_GET_USER_STATE_FROM_STATE

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds700
    └───inc
        └───liblfds700
                lfds700_queue_bounded_singleconsumer_singleproducer.h

Macro

#define LFDS700_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state )

Parameters

queue_bss_state

An initialized struct lfds700_queue_bss_state. Not a pointer to it - the struct itself.

Return Value

Returns a void *, the user_state argument from lfds700_queue_bss_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 "liblfds700.h"
#include <stdio.h>
#include <string.h>

int main()
{
  char
    queue_bss_name[64] = "Idiot Prayer";

  struct lfds700_queue_bss_element
    element_array[64];

  struct lfds700_queue_bss_state
    qbsss;

  void
    *user_state;

  lfds700_misc_library_init_valid_on_current_logical_core();

  lfds700_queue_bss_init_valid_on_current_logical_core( &qbsss, element_array, 64, (void *) queue_bss_name );

  user_state = LFDS700_QUEUE_BSS_GET_USER_STATE_FROM_STATE( qbsss );

  printf( "queue_bss name is \"%s\"\n", (char *) user_state );

  lfds700_queue_bss_cleanup( &qbsss, NULL );

  lfds700_misc_library_cleanup();

  return( EXIT_SUCCESS );
}

See Also