mdcore  0.1.5
Data Structures | Defines | Functions | Variables
/home/pedro/work/mdcore/src/fifo.h File Reference

Go to the source code of this file.

Data Structures

struct  fifo

Defines

#define fifo_err_ok   0
#define fifo_err_null   -1
#define fifo_err_malloc   -2
#define fifo_err_pthread   -3
#define fifo_err_fifo_full   -4
#define fifo_err_fifo_empty   -5

Functions

int fifo_init (struct fifo *f, int size)
 Initialize the given fifo.
int fifo_pop_nb (struct fifo *f, int *e)
 Remove an element from the fifo, non-blocking.
int fifo_pop (struct fifo *f, int *e)
 Remove an element from the fifo, blocking.
int fifo_push_nb (struct fifo *f, int e)
 Add an element to the fifo, non-blocking.
int fifo_push (struct fifo *f, int e)
 Add an element to the fifo, blocking.

Variables

int fifo_err

Define Documentation

#define fifo_err_fifo_empty   -5
#define fifo_err_fifo_full   -4
#define fifo_err_malloc   -2
#define fifo_err_null   -1
#define fifo_err_ok   0
#define fifo_err_pthread   -3

Function Documentation

int fifo_init ( struct fifo f,
int  size 
)

Initialize the given fifo.

Parameters:
fThe fifo
sizeThe number of entries
Returns:
fifo_err_ok or < 0 on error (see fifo_err).
int fifo_pop ( struct fifo f,
int *  e 
)

Remove an element from the fifo, blocking.

Parameters:
fThe fifo
ePointer to the popped element.
Returns:
The new number of entries or < 0 on error (see fifo_err).
int fifo_pop_nb ( struct fifo f,
int *  e 
)

Remove an element from the fifo, non-blocking.

Parameters:
fThe fifo
ePointer to the popped element.
Returns:
The new number of entries or < 0 on error (see fifo_err).
int fifo_push ( struct fifo f,
int  e 
)

Add an element to the fifo, blocking.

Parameters:
fThe fifo
eThe entry to add.
Returns:
The new number of entries or < 0 on error (see fifo_err).
int fifo_push_nb ( struct fifo f,
int  e 
)

Add an element to the fifo, non-blocking.

Parameters:
fThe fifo
eThe entry to add.
Returns:
The new number of entries or < 0 on error (see fifo_err).

Variable Documentation

int fifo_err

The ID of the last error.

 All Data Structures Files Functions Variables Typedefs Enumerator Defines