macro LFDS710_QUEUE_BSS_GET_USER_STATE_FROM_STATE

From liblfds.org
Jump to navigation Jump to search

Source File

└───liblfds710
    └───inc
        └───liblfds710
                lfds710_queue_bounded_singleproducer_singleconsumer.h

Macro

#define LFDS710_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state )

Parameters

queue_bss_state

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

Return Value

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

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

  struct lfds710_queue_bss_element
    element_array[64];

  struct lfds710_queue_bss_state
    qbsss;

  void
    *user_state;

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

  user_state = LFDS710_QUEUE_BSS_GET_USER_STATE_FROM_STATE( qbsss );

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

  lfds710_queue_bss_cleanup( &qbsss, NULL );

  return( EXIT_SUCCESS );
}

See Also