| libdatatypes 0.3.2
    Abstract datatypes for C. | 
Asynchronous queue. More...
#include <stdlib.h>#include <stdio.h>#include <sys/time.h>#include <assert.h>#include <err.h>#include "asyncqueue.h"Go to the source code of this file.
| Macros | |
| #define | PTHREAD_CRITICAL_CALL(fn, ...) | 
| #define | PTHREAD_CALL(fn, ...) | 
| Functions | |
| AsyncQueue * | async_queue_new (CompareFunc compare, FreeFunc free, Pool *pool) | 
| void | async_queue_init (AsyncQueue *queue, CompareFunc compare, FreeFunc free, Pool *pool) | 
| void | async_queue_destroy (AsyncQueue *queue) | 
| void | async_queue_free (AsyncQueue *queue) | 
| void | async_queue_push (AsyncQueue *queue, void *data) | 
| bool | async_queue_pop (AsyncQueue *queue, void *data) | 
| bool | async_queue_pop_timeout (AsyncQueue *queue, void *data, uint32_t ms) | 
| void | async_queue_clear (AsyncQueue *queue) | 
| size_t | async_queue_count (AsyncQueue *queue) | 
Asynchronous queue.
Definition in file asyncqueue.c.
| #define PTHREAD_CALL | ( | fn, | |
| ... | |||
| ) | 
Definition at line 82 of file asyncqueue.c.
| #define PTHREAD_CRITICAL_CALL | ( | fn, | |
| ... | |||
| ) | 
Definition at line 50 of file asyncqueue.c.
| void async_queue_clear | ( | AsyncQueue * | queue | ) | 
| size_t async_queue_count | ( | AsyncQueue * | queue | ) | 
| queue | an AsyncQueue | 
Gets the number of stored items.
Definition at line 217 of file asyncqueue.c.
| void async_queue_destroy | ( | AsyncQueue * | queue | ) | 
| queue | an AsyncQueue | 
Frees all items and the queue pointer.
Definition at line 74 of file asyncqueue.c.
| void async_queue_free | ( | AsyncQueue * | queue | ) | 
| queue | an AsyncQueue | 
Frees all items without freeing the queue pointer.
Definition at line 92 of file asyncqueue.c.
| void async_queue_init | ( | AsyncQueue * | queue, | 
| CompareFunc | compare, | ||
| FreeFunc | free, | ||
| Pool * | pool | ||
| ) | 
| queue | an AsyncQueue | 
| compare | function to compare item data | 
| free | function to free item data or NULL | 
| pool | a user-defined memory pool for creating/destroying QueueItems or NULL | 
Initializes an AsyncQueue.
Definition at line 61 of file asyncqueue.c.
| AsyncQueue * async_queue_new | ( | CompareFunc | compare, | 
| FreeFunc | free, | ||
| Pool * | pool | ||
| ) | 
| compare | function to compare item data | 
| free | function to free item data or NULL | 
| pool | a user-defined memory pool for creating/destroying QueueItems or NULL | 
Creates a new AsyncQueue.
Definition at line 33 of file asyncqueue.c.
| bool async_queue_pop | ( | AsyncQueue * | queue, | 
| void * | data | ||
| ) | 
| queue | an AsyncQueue | 
| data | location to store data of removed element | 
Pops data from the queue.
Definition at line 191 of file asyncqueue.c.
| bool async_queue_pop_timeout | ( | AsyncQueue * | queue, | 
| void * | data, | ||
| uint32_t | ms | ||
| ) | 
| queue | an AsyncQueue | 
| data | location to store data of removed element | 
| ms | timeout in milliseconds | 
Pops data from the queue. Blocks for ms milliseconds.
Definition at line 199 of file asyncqueue.c.
| void async_queue_push | ( | AsyncQueue * | queue, | 
| void * | data | ||
| ) | 
| queue | an AsyncQueue | 
| data | data to push | 
Pushs data onto the queue.
Definition at line 103 of file asyncqueue.c.