25 #ifndef BUFFERED_FIFO_H 
   26 #define BUFFERED_FIFO_H 
void * Buffered_FIFO_chunk_pop(struct Buffered_FIFO_chunk *ch, void *dest)
pops en element from a chunk 
 
MALP_Spinlock head_lock
a lock for concurent access to the head 
 
MALP_Spinlock tail_lock
a lock for concurent access to the tail 
 
uint64_t chunk_size
the size of the composing chunks 
 
size_t elem_size
the size of each stored element 
 
void Buffered_FIFO_release(struct Buffered_FIFO *fifo, void(*free_func)(void *))
releases a FIFO 
 
This is a struct defining a FIFO It is composed of several Buffered_FIFO_chunk. 
 
void * Buffered_FIFO_push(struct Buffered_FIFO *fifo, void *elem)
Pushes an element into a FIFO. 
 
char * payload
the actual data 
 
void * Buffered_FIFO_pop(struct Buffered_FIFO *fifo, void *dest)
Pops an element from a FIFO. 
 
void * Buffered_FIFO_chunk_push(struct Buffered_FIFO_chunk *ch, void *elem)
Pushes an element into a chunk. 
 
MALP_Spinlock lock
a lock for concurrent access to element_count 
 
int MALP_Spinlock_unlock(MALP_Spinlock *mutex)
Unlocks the given MALP_Spinlock. 
 
struct Buffered_FIFO_chunk * tail
the tail chunk (from where elements are popped 
 
size_t elem_size
the size of stored elements 
 
uint64_t start_offset
the start offset (position of oldest element in payload 
 
struct Buffered_FIFO_chunk * Buffered_FIFO_chunk_new(uint64_t chunk_size, uint64_t elem_size)
Allocates a new Buffered_FIFO_chunk. 
 
uint64_t Buffered_FIFO_count(struct Buffered_FIFO *fifo)
Thread-safely gets the number of elements stored in the FIFO. 
 
void Buffered_FIFO_chunk_release(struct Buffered_FIFO_chunk *ch)
Deallocates a new Buffered_FIFO_chunk. 
 
static struct Buffered_FIFO_chunk * Buffered_FIFO_chunk_prev(struct Buffered_FIFO_chunk *ch)
Thread-safely gets the previous chunk (ch->prev) 
 
int MALP_Spinlock_lock(MALP_Spinlock *mutex)
Locks the given MALP_Spinlock. 
 
MALP_Spinlock lock
a lock for concurrent internal manipulations 
 
volatile unsigned int MALP_Spinlock
The type of spinlocks in MALP. 
 
struct Buffered_FIFO_chunk * prev
previous chunk of the FIFO (newer elements) 
 
struct Buffered_FIFO_chunk * head
the head chunk (chere elements are pushed 
 
void Buffered_FIFO_init(struct Buffered_FIFO *fifo, uint64_t chunk_size, size_t elem_size)
Initializes a Buffered_FIFO. 
 
static void Buffered_FIFO_chunk_ctx_prev(struct Buffered_FIFO_chunk *ch, struct Buffered_FIFO_chunk *prev)
Thread-safely sets the previous chunk (ch->prev) 
 
void Buffered_FIFO_chunk_init(struct Buffered_FIFO_chunk *ch, uint64_t chunk_size, size_t elem_size)
Initializes a Buffered_FIFO_chunk. 
 
uint64_t end_offset
the end offset (position of the end of newest element in payload 
 
uint64_t chunk_size
the size of the current chunk 
 
Structure defining a chunk of FIFO. The Buffered_FIFO is made of several Buffered_FIFO_chunk containi...
 
uint64_t elem_count
the number of elements currently stored in the FIFO