function lfds711_stack_pop

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds711
    ├───inc
    │   └───liblfds711
    │           lfds711_stack.h
    └───src
        └───lfds711_stack
                lfds711_stack_pop.c

Opaque Structures

struct lfds711_misc_prng_state;
struct lfds711_stack_element;

Prototype

int lfds711_stack_pop( struct lfds711_stack_state *ss,
                       struct lfds711_stack_element **se );

Parameters

struct lfds711_stack_state *ss

A pointer to an initialized struct lfds711_stack_state.

struct lfds711_stack_element **se

A pointer to a user-allocated struct lfds711_stack_state *, which is set to point to the stack element popped from the stack.

Return Value

Returns 1 on a successful pop. Returns 0 if popping failed. Popping only fails if the stack is empty.

Notes

This function pops a stack element, with its key and value, from the stack. The key and value are read from the stack element by the macros LFDS711_STACK_GET_KEY_FROM_ELEMENT and LFDS711_STACK_GET_VALUE_FROM_ELEMENT respectively, and can only be correctly read when a stack element is outside of a stack; the macros can be issued at any time, of course, but if the element has not been popped by the thread calling the macro, then there is no guarantee the key and value read will be that which was written into the element. You were warned.

See Also