Multi-ApplicationOnlineProfiling
2.1
|
This is an implementation of a Buffered LIFO data storage. More...
Modules | |
Internals | |
Not to be used directly. | |
Data Structures | |
struct | Buffered_LIFO |
Structure defining buffered LIFO. More... | |
Functions | |
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... | |
This is an implementation of a Buffered LIFO data storage.
It is implemented using several Buffered_LIFO_chunk.
Sample usage :
Consequently in this configuration, we pop elems in the reverse order by definition of the LIFO (2,1,0).
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.
lifo | pointer to an initialized Buffered_LIFO |
Definition at line 188 of file Buffered_LIFO.c.
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 !
lifo | pointer to an initialized Buffered_LIFO |
Definition at line 198 of file Buffered_LIFO.c.
void Buffered_LIFO_head_unlock | ( | struct Buffered_LIFO * | lifo | ) |
Unlocks the Buffered_LIFO after a call to Buffered_LIFO_head.
lifo | pointer to an initialized Buffered_LIFO |
Definition at line 204 of file Buffered_LIFO.c.
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.
sizeof_payload | size of a payload element |
chunk_size | the number of elements the chunk can contain |
Definition at line 132 of file Buffered_LIFO.c.
void* Buffered_LIFO_pop | ( | struct Buffered_LIFO * | lifo, |
void * | elem | ||
) |
Push an element of size sizeof_payload in the Buffered_LIFO.
lifo | pointer to an initialized Buffered_LIFO |
elem | pointer to an elem of sizeof_payload to which we want data to be copied |
Definition at line 171 of file Buffered_LIFO.c.
void Buffered_LIFO_push | ( | struct Buffered_LIFO * | lifo, |
void * | elem | ||
) |
Push an element of size sizeof_payload in the Buffered_LIFO.
lifo | pointer to an initialized Buffered_LIFO |
elem | pointer to an elem of sizeof_payload |
Definition at line 164 of file Buffered_LIFO.c.
void Buffered_LIFO_release | ( | struct Buffered_LIFO * | lifo, |
void(*)(void *) | free_func | ||
) |
Releases a Buffered_LIFO and all its chunks.
sizeof_payload | size of a payload element |
chunk_size | the number of elements the chunk can contain |
free_func | a function to be called over each elem still present in the FIFO (NULL if node) |
Definition at line 141 of file Buffered_LIFO.c.