Difference between pages "r7.1.1:Macro LFDS711 QUEUE BMM GET USER STATE FROM STATE" and "r7.1.1:Macro LFDS711 QUEUE BSS GET USER STATE FROM STATE"

From liblfds.org
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
m (1 revision imported)
 
Line 1: Line 1:
{{DISPLAYTITLE:macro LFDS711_QUEUE_BMM_GET_USER_STATE_FROM_STATE}}
{{DISPLAYTITLE:macro LFDS711_QUEUE_BSS_GET_USER_STATE_FROM_STATE}}
==Source File==
==Source File==
  └───liblfds711
  └───liblfds711
     └───inc
     └───inc
         └───liblfds711
         └───liblfds711
                 lfds711_queue_bmm.h
                 lfds711_queue_bounded_singleproducer_singleconsumer.h


==Macro==
==Macro==
  #define LFDS711_QUEUE_BMM_GET_USER_STATE_FROM_STATE( queue_bmm_state )
  #define LFDS711_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state )


==Parameters==
==Parameters==
''queue_bmm_state''
''queue_bss_state''
: An initialized ''struct lfds711_queue_bmm_state''.  Not a pointer to it - the struct itself.
: An initialized ''struct lfds711_queue_bss_state''.  Not a pointer to it - the struct itself.


==Return Value==
==Return Value==
Returns a ''void *'', the ''user_state'' argument from ''[[r7.1.1:function lfds711_queue_bmm_init_valid_on_current_logical_core|lfds711_bmm_queue_init_valid_on_current_logical_core]]''.
Returns a ''void *'', the ''user_state'' argument from ''[[r7.1.1:function lfds711_queue_bss_init_valid_on_current_logical_core|lfds711_queue_bss_init_valid_on_current_logical_core]]''.


==Notes==
==Notes==
Line 22: Line 22:


==Example==
==Example==
Coming soon! (no, really!)
  #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==
==See Also==
* [[r7.1.1:Queue (bounded, many producer, many consumer)|Queue (bounded, many producer, many consumer)]]
* [[r7.1.1:Queue (bounded, single producer, single consumer)|Queue (bounded, single producer, single consumer)]]

Latest revision as of 18:12, 16 February 2017

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