Multi-ApplicationOnlineProfiling  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Buffered_LIFO.h File Reference
#include <stdint.h>
#include <stdlib.h>
#include "Spinlock.h"
Include dependency graph for Buffered_LIFO.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Buffered_LIFO_chunk
 Structure defining a chunk of LIFO. A buffered lifo consists in several chunks which are stacked in a lifo fashion. Moreover those chunks gather several elems in order to avoid alocation and dealocation plus it reduces the pointer versus data ratio for small amount of data. More...
 
struct  Buffered_LIFO
 Structure defining buffered LIFO. More...
 

Functions

struct Buffered_LIFO_chunkBuffered_LIFO_chunk_new (size_t sizeof_payload, uint64_t chunk_size, struct Buffered_LIFO_chunk *prev)
 Allocates an empty Buffered_LIFO_chunk pointing to prev. More...
 
void Buffered_LIFO_chunk_release (struct Buffered_LIFO_chunk *chunk, size_t sizeof_payload, void(*free_func)(void *))
 Releases a Buffered_LIFO_chunk note that it does not recurses over previous chunks. More...
 
struct Buffered_LIFO_chunkBuffered_LIFO_chunk_push (struct Buffered_LIFO_chunk *chunk, void *elem, size_t sizeof_payload, uint64_t chunk_size)
 Push a new elem in the Buffered_LIFO_chunk. More...
 
struct Buffered_LIFO_chunkBuffered_LIFO_chunk_pop (struct Buffered_LIFO_chunk *chunk, size_t sizeof_payload, uint64_t chunk_size, void *elem, int *did_ret)
 Get an element from the Buffered_LIFO_chunk. More...
 
void * Buffered_LIFO_chunk_head (struct Buffered_LIFO_chunk *chunk, size_t sizeof_payload)
 Get a pointer to the Buffered_LIFO_chunk head eleme (NULL if none) More...
 
void Buffered_LIFO_init (struct Buffered_LIFO *lifo, size_t sizeof_payload, uint64_t chunk_size)
 Initializes a Buffered_LIFO ready to contains elems of size sizeof_payload with chunk_size chunks. More...
 
void Buffered_LIFO_release (struct Buffered_LIFO *lifo, void(*free_func)(void *))
 Releases a Buffered_LIFO and all its chunks. More...
 
void Buffered_LIFO_push (struct Buffered_LIFO *lifo, void *elem)
 Push an element of size sizeof_payload in the Buffered_LIFO. More...
 
void * Buffered_LIFO_pop (struct Buffered_LIFO *lifo, void *elem)
 Push an element of size sizeof_payload in the Buffered_LIFO. More...
 
void * Buffered_LIFO_head (struct Buffered_LIFO *lifo)
 Get a reference to the head element of the Buffered_LIFO note that as no lock is held this reference can be invalidated by another thread. In such context you can use Buffered_LIFO_head_locked instead. More...
 
void * Buffered_LIFO_head_locked (struct Buffered_LIFO *lifo)
 Get a reference to the head element of the Buffered_LIFO but keeps the LIFO locked in order to allow thread safe manipulation of the head. Note that Buffered_LIFO_head_unlock must be called to unlock the LIFO after ! More...
 
void Buffered_LIFO_head_unlock (struct Buffered_LIFO *lifo)
 Unlocks the Buffered_LIFO after a call to Buffered_LIFO_head. More...