macro LFDS700_QUEUE_GET_USER_STATE_FROM_STATE

From liblfds.org
Revision as of 03:54, 25 December 2015 by Admin (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source File

└───liblfds700
    └───inc
        └───liblfds700
                lfds700_queue.h

Macro

#define LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( queue_state )

Parameters

queue_state

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

Return Value

Returns a void *, the user_state argument from lfds700_queue_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_name[64] = "People Ain't No Good";

  struct lfds700_queue_element
    qe_dummy;
 
  struct lfds700_queue_state
    qs;

  void
    *user_state;

  lfds700_misc_library_init_valid_on_current_logical_core();

  lfds700_queue_init_valid_on_current_logical_core( &qs, &qe_dummy, (void *) queue_name );

  user_state = LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( qs );

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

  lfds700_queue_cleanup( &qs, NULL );

  lfds700_misc_library_cleanup();

  return( EXIT_SUCCESS );
}

See Also