Simple pointer queue (FIFO) implementation.
More...
#include <sys/types.h>
#include <inttypes.h>
Go to the source code of this file.
|
typedef struct fifo_ctx_s | fifo_ctx_t |
|
typedef void *( | fifo_elem_ctx_dup_fxn_t) (const void *) |
|
typedef void( | fifo_elem_ctx_release_fxn_t) (void **) |
|
typedef struct fifo_elem_alloc_fxn_s | fifo_elem_alloc_fxn_t |
|
|
fifo_ctx_t * | fifo_open (size_t slots_max, size_t chunk_size_max, uint32_t flags, const fifo_elem_alloc_fxn_t *fifo_elem_alloc_fxn) |
|
fifo_ctx_t * | fifo_shm_open (size_t slots_max, size_t chunk_size_max, uint32_t flags, const char *fifo_file_name) |
|
fifo_ctx_t * | fifo_shm_exec_open (size_t slots_max, size_t chunk_size_max, uint32_t flags, const char *fifo_file_name) |
|
void | fifo_close (fifo_ctx_t **ref_fifo_ctx) |
|
void | fifo_set_blocking_mode (fifo_ctx_t *fifo_ctx, int do_block) |
|
int | fifo_put_dup (fifo_ctx_t *fifo_ctx, const void *elem, size_t elem_size) |
|
int | fifo_put (fifo_ctx_t *fifo_ctx, void **ref_elem, size_t elem_size) |
|
int | fifo_get (fifo_ctx_t *fifo_ctx, void **ref_elem, size_t *ref_elem_size) |
|
int | fifo_timedget (fifo_ctx_t *fifo_ctx, void **ref_elem, size_t *ref_elem_size, int64_t tout_usecs) |
|
int | fifo_show (fifo_ctx_t *fifo_ctx, void **elem, size_t *elem_size) |
|
ssize_t | fifo_get_buffer_level (fifo_ctx_t *fifo_ctx) |
|
int | fifo_traverse (fifo_ctx_t *fifo_ctx, int elem_cnt, void(*it_fxn)(void *elem, ssize_t elem_size, int idx, void *it_arg, int *ref_flag_break), void *it_arg) |
|
void | fifo_empty (fifo_ctx_t *fifo_ctx) |
|
Simple pointer queue (FIFO) implementation.
- Author
- Rafael Antoniello
Definition in file fifo.h.
#define FIFO_O_NONBLOCK 1 |
FLag to indicate this FIFO is non-blocking. FIFO is blocking by default (namely, if this flag is not set), which means a writing operation (put) will block until an empty slot is available and reading (get) will block if FIFO is empty.
Definition at line 50 of file fifo.h.
#define FIFO_PROCESS_SHARED 2 |
FLag to indicate this FIFO is to be defined in shared memory. If it is the case, the FIFO can be shared by parent and son processes (this is thought to be used as an interprocess communication mechanism).
Definition at line 56 of file fifo.h.
//TODO
Definition at line 327 of file fifo.c.
//TODO
Definition at line 456 of file fifo.c.
int fifo_get |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
void ** |
ref_elem, |
|
|
size_t * |
ref_elem_size |
|
) |
| |
//TODO
Definition at line 366 of file fifo.c.
ssize_t fifo_get_buffer_level |
( |
fifo_ctx_t * |
fifo_ctx | ) |
|
//TODO
Definition at line 385 of file fifo.c.
//TODO
Definition at line 195 of file fifo.c.
int fifo_put |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
void ** |
ref_elem, |
|
|
size_t |
elem_size |
|
) |
| |
//TODO
Definition at line 361 of file fifo.c.
int fifo_put_dup |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
const void * |
elem, |
|
|
size_t |
elem_size |
|
) |
| |
//TODO
Definition at line 355 of file fifo.c.
void fifo_set_blocking_mode |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
int |
do_block |
|
) |
| |
//TODO
Definition at line 332 of file fifo.c.
fifo_ctx_t* fifo_shm_open |
( |
size_t |
slots_max, |
|
|
size_t |
chunk_size_max, |
|
|
uint32_t |
flags, |
|
|
const char * |
fifo_file_name |
|
) |
| |
- Parameters
-
slots_max | |
chunk_size_max | |
flags | |
fifo_file_name | This file-name is assigned to the shared memory object to facilitate opening FIFO in a fork-exec setting. |
Definition at line 229 of file fifo.c.
int fifo_show |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
void ** |
elem, |
|
|
size_t * |
elem_size |
|
) |
| |
//TODO
Definition at line 379 of file fifo.c.
int fifo_timedget |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
void ** |
ref_elem, |
|
|
size_t * |
ref_elem_size, |
|
|
int64_t |
tout_usecs |
|
) |
| |
//TODO
Definition at line 372 of file fifo.c.
int fifo_traverse |
( |
fifo_ctx_t * |
fifo_ctx, |
|
|
int |
elem_cnt, |
|
|
void(*)(void *elem, ssize_t elem_size, int idx, void *it_arg, int *ref_flag_break) |
it_fxn, |
|
|
void * |
it_arg |
|
) |
| |
//TODO
Definition at line 400 of file fifo.c.