libguac 1.6.0
 
Loading...
Searching...
No Matches
fifo.h File Reference

Provides an abstract FIFO implementation (guac_fifo), which can support arbitrary element sizes and storage. More...

Go to the source code of this file.

Data Structures

struct  guac_fifo
 Generic base structure for a FIFO of arbitrary events. More...
 

Functions

void guac_fifo_init (guac_fifo *fifo, void *items, size_t max_items, size_t item_size)
 Initializes the given guac_fifo such that it may be safely included in shared memory and accessed by multiple processes.
 
void guac_fifo_destroy (guac_fifo *fifo)
 Releases all underlying resources used by the given guac_fifo, such as pthread mutexes and conditions.
 
void guac_fifo_invalidate (guac_fifo *fifo)
 Marks the given FIFO as invalid, preventing any further additions or removals from the FIFO.
 
int guac_fifo_is_valid (guac_fifo *fifo)
 Returns whether the given FIFO is still valid.
 
void guac_fifo_lock (guac_fifo *fifo)
 Acquires exclusive access to this guac_fifo.
 
void guac_fifo_unlock (guac_fifo *fifo)
 Relinquishes exclusive access to this guac_fifo.
 
int guac_fifo_enqueue (guac_fifo *fifo, const void *item)
 Adds a copy of the given item to the end of the given FIFO, and signals any waiting threads that the FIFO is now non-empty.
 
int guac_fifo_enqueue_and_lock (guac_fifo *fifo, const void *item)
 Atomically adds a copy of the given item to the end of the given FIFO, signals any waiting threads that the FIFO is now non-empty, and leaves the given FIFO locked.
 
int guac_fifo_dequeue (guac_fifo *fifo, void *item)
 Removes the oldest (first) item from the FIFO, storing a copy of that item within the provided buffer.
 
int guac_fifo_dequeue_and_lock (guac_fifo *fifo, void *item)
 Atomically removes the oldest (first) item from the FIFO, storing a copy of that item within the provided buffer.
 
int guac_fifo_timed_dequeue (guac_fifo *fifo, void *item, int msec_timeout)
 Removes the oldest (first) item from the FIFO, storing a copy of that item within the provided buffer.
 
int guac_fifo_timed_dequeue_and_lock (guac_fifo *fifo, void *item, int msec_timeout)
 Atomically removes the oldest (first) item from the FIFO, storing a copy of that item within the provided buffer.
 

Detailed Description

Provides an abstract FIFO implementation (guac_fifo), which can support arbitrary element sizes and storage.