Difference between pages "r7.1.1:Macro LFDS711 QUEUE UMM GET VALUE FROM ELEMENT" and "r7.1.1:Macro LFDS711 QUEUE UMM SET KEY IN ELEMENT"

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_UMM_GET_VALUE_FROM_ELEMENT}}
{{DISPLAYTITLE:macro LFDS711_QUEUE_UMM_SET_KEY_IN_ELEMENT}}
==Source Files==
==Source Files==
  └───liblfds711
  └───liblfds711
Line 10: Line 10:


==Macro==
==Macro==
  #define LFDS711_QUEUE_UMM_GET_VALUE_FROM_ELEMENT( queue_umm_element )
  #define LFDS711_QUEUE_UMM_SET_KEY_IN_ELEMENT( queue_umm_element, new_key )


==Parameters==
==Parameters==
''queue_umm_element''
''queue_umm_element''
: A ''struct lfds711_queue_umm_element''.  Not a pointer to it - the struct itself.
: A ''struct lfds711_queue_umm_element'', which is not currently part of a freelist.  Not a pointer to it - the struct itself.
 
''new_key''
: A pointer, which will be cast by the macro to a ''void *'', which the key in ''queue_umm_element'' is set to.


==Return Value==
==Return Value==
Returns a void pointer, the value from the element.
No return value.


==Notes==
==Notes==
The value set into a queue element is only guranteed to be visible to another logical core once the element has been dequeued by a thread running on that logical core.
The key in a queue element can only be set when the element is outside of a queue (i.e. has been dequeued, or has yet to be enqueued).  This macro can be called at any time, but if it is used on an element which is present in a queue, all bets are off - all threads on the logical core which does this will see the change, but there is no guarantee any other logical cores will ever see the change.  You were warned.


So, for example, if there was a globally allocated queue element, where a thread on logical core A set a value and then enqueued the element to the queue, a thread on logical core B would only be guaranteed to see the value set by the other thread once it dequeues the element from the queue.
As with all ''liblfds'' macros, the macro operates on the structure itself, not a pointer to it.


As with all ''liblfds'' macros, the macro operates on the structure itself, not a pointer to it.
The key is not used in any way by the queue, and is provided for convenience when moving keys and values between different data structures.


==Example==
==Example==
Line 31: Line 34:
==See Also==
==See Also==
* [[r7.1.1:Queue (unbounded, many producer, many consumer)|Queue (unbounded, many producer, many consumer)]]
* [[r7.1.1:Queue (unbounded, many producer, many consumer)|Queue (unbounded, many producer, many consumer)]]
* ''[[r7.1.1:macro LFDS711_QUEUE_UMM_SET_VALUE_IN_ELEMENT|LFDS711_QUEUE_UMM_SET_VALUE_IN_ELEMENT]]''
* ''[[r7.1.1:macro LFDS711_QUEUE_UMM_GET_KEY_FROM_ELEMENT|LFDS711_QUEUE_UMM_GET_KEY_FROM_ELEMENT]]''

Latest revision as of 18:12, 16 February 2017

Source Files

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_queue_umm.h

Opaque Structures

struct lfds711_queue_umm_element;

Macro

#define LFDS711_QUEUE_UMM_SET_KEY_IN_ELEMENT( queue_umm_element, new_key )

Parameters

queue_umm_element

A struct lfds711_queue_umm_element, which is not currently part of a freelist. Not a pointer to it - the struct itself.

new_key

A pointer, which will be cast by the macro to a void *, which the key in queue_umm_element is set to.

Return Value

No return value.

Notes

The key in a queue element can only be set when the element is outside of a queue (i.e. has been dequeued, or has yet to be enqueued). This macro can be called at any time, but if it is used on an element which is present in a queue, all bets are off - all threads on the logical core which does this will see the change, but there is no guarantee any other logical cores will ever see the change. You were warned.

As with all liblfds macros, the macro operates on the structure itself, not a pointer to it.

The key is not used in any way by the queue, and is provided for convenience when moving keys and values between different data structures.

Example

Coming soon. No, really! (Written 29th Dec 2015).

See Also