function lfds710_stack_pop

Jump to navigation Jump to search

Source Files

    │   └───liblfds710
    │           lfds710_stack.h

Opaque Structures

struct lfds710_misc_prng_state;
struct lfds710_stack_element;


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


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.


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