function lfds710_stack_pop

From liblfds.org
Jump to navigation Jump to search

Source Files

└───liblfds710
    ├───inc
    │   └───liblfds710
    │           lfds710_stack.h
    └───src
        └───lfds710_stack
                lfds710_stack_pop.c

Opaque Structures

struct lfds710_misc_prng_state;
struct lfds710_stack_element;

Prototype

int lfds710_stack_pop( struct lfds710_stack_state *ss,
                       struct lfds710_stack_element **se );

Parameters

struct lfds710_stack_state *ss

A pointer to an initialized struct lfds710_stack_state.

struct lfds710_stack_element **se

A pointer to a user-allocated struct lfds710_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 LFDS710_STACK_GET_KEY_FROM_ELEMENT and LFDS710_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