P99

◆ P99_FIFO_POP

#define P99_FIFO_POP (   L)

Pop the front element from an atomic FIFO L.

This implements a generic interface to an atomic FIFO (First In - First Out) data structure. To use it you just have do some preparatory declarations and add a p99_lifo field to your data structure:

P99_FIFO_DECLARE(myData_ptr);
struct myData {
...
myData_ptr p99_lifo;
...
};
extern P99_FIFO(myData_ptr) head;

Now head can be used as the head of a FIFO:

myData_ptr el = P99_NEW(myData, \/\* your initializer arguments \*\/);
P99_FIFO_APPEND(&head, el);
...
for (myData_ptr el = P99_FIFO_POP(&head);
el;
el = P99_FIFO_POP(&head)) {
// do something with el and then
free(el);
}
See also
P99_FIFO_CLEAR
P99_FIFO
P99_FIFO_DECLARE
P99_FIFO_APPEND
Remarks
argument 0 maybe evaluated several times for its type but only once for its value

Definition at line 136 of file p99_fifo.h.

P99_FIFO_POP
#define P99_FIFO_POP(L)
Pop the front element from an atomic FIFO L.
Definition: p99_fifo.h:136
P99_FIFO_APPEND
#define P99_FIFO_APPEND(L, EL)
Append element EL to an atomic FIFO L.
Definition: p99_fifo.h:61
P99_FIFO
#define P99_FIFO(T)
Definition: p99_fifo.h:39
P99_NEW
#define P99_NEW(...)
Allocate an element of type T as given by the first argument and initialize it with the remaining arg...
Definition: p99_new.h:314
P99_DECLARE_STRUCT
#define P99_DECLARE_STRUCT(NAME)
forward declaration of a struct NAME
Definition: p99_type.h:59
P99_POINTER_TYPE
#define P99_POINTER_TYPE(T)
Declare derived pointer types with endings "_ptr" and "_cptr".
Definition: p99_type.h:132
P99_FIFO_DECLARE
#define P99_FIFO_DECLARE(T)
Definition: p99_fifo.h:40