macro LFDS711_QUEUE_BSS_GET_USER_STATE_FROM_STATE

From liblfds.org
Revision as of 18:12, 16 February 2017 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_queue_bounded_singleproducer_singleconsumer.h

Macro

#define LFDS711_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state )

Parameters

queue_bss_state

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

Return Value

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

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

  struct lfds711_queue_bss_element
    element_array[64];

  struct lfds711_queue_bss_state
    qbsss;

  void
    *user_state;

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

  user_state = LFDS711_QUEUE_BSS_GET_USER_STATE_FROM_STATE( qbsss );

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

  lfds711_queue_bss_cleanup( &qbsss, NULL );

  return( EXIT_SUCCESS );
}

See Also