This queue implementation enables a producer and a consumer to communicate via a queue. More...
|  | 
| 
 Data Structures | 
| struct | CircQueueStruct | 
|  | The simple version of pcqueue has dropped the function of being expanded if the queue is full.  More... 
 | 
| struct | PCQueueStruct | 
|  | The beginning of definitions for simple pcqueue.  More... 
 | 
| struct | PCQueueStruct | 
|  | The beginning of definitions for simple pcqueue.  More... 
 | 
| struct | FreeNodePoolStruct | 
| struct | MPSCQueueStruct | 
| struct | MPMCDataNodeStruct | 
| struct | FreeMPMCNodePoolStruct | 
| struct | MPMCQueueStruct | 
| 
 Typedefs | 
| typedef struct CircQueueStruct * | CircQueue | 
| typedef struct PCQueueStruct * | PCQueue | 
| typedef char ** | DataNode | 
| typedef struct FreeNodePoolStruct * | FreeNodePool | 
| typedef struct MPSCQueueStruct * | MPSCQueue | 
| typedef struct MPMCDataNodeStruct * | MPMCDataNode | 
| typedef struct FreeMPMCNodePoolStruct *
 | FreeMPMCNodePool | 
| typedef struct MPMCQueueStruct * | MPMCQueue | 
| 
 Functions | 
| static PCQueue | PCQueueCreate (void) | 
| static void | PCQueueDestroy (PCQueue Q) | 
| static int | PCQueueEmpty (PCQueue Q) | 
| static int | PCQueueLength (PCQueue Q) | 
| static char * | PCQueueTop (PCQueue Q) | 
| static char * | PCQueuePop (PCQueue Q) | 
| static void | PCQueuePush (PCQueue Q, char *data) | 
| void | ReportOverflow () | 
| static unsigned int | WrappedDifference (unsigned int push, unsigned int pull) | 
| static int | QueueFull (unsigned int push, unsigned int pull) | 
| static DataNode | DataNodeCreate (void) | 
| static FreeNodePool | FreeNodePoolCreate (void) | 
| static void | FreeNodePoolDestroy (FreeNodePool q) | 
| static DataNode | get_free_node (FreeNodePool q) | 
| static void | add_free_node (FreeNodePool q, DataNode available) | 
| static MPSCQueue | MPSCQueueCreate (void) | 
| static void | MPSCQueueDestroy (MPSCQueue Q) | 
| static unsigned int | get_node_index (unsigned int value) | 
| static DataNode | get_push_node (MPSCQueue Q, unsigned int push_idx) | 
| static DataNode | get_pop_node (MPSCQueue Q, unsigned int pull_idx) | 
| static void | check_mem_reclamation (MPSCQueue Q, unsigned int pull_idx, DataNode node) | 
| static int | MPSCQueueEmpty (MPSCQueue Q) | 
| static int | MPSCQueueLength (MPSCQueue Q) | 
| static char * | MPSCQueueTop (MPSCQueue Q) | 
| static char * | MPSCQueuePop (MPSCQueue Q) | 
| static void | MPSCQueuePush (MPSCQueue Q, char *data) | 
| static MPMCDataNode | MPMCDataNodeCreate (void) | 
| static FreeMPMCNodePool | FreeMPMCNodePoolCreate (void) | 
| static void | FreeMPMCNodePoolDestroy (FreeMPMCNodePool q) | 
| static MPMCDataNode | mpmc_get_free_node (FreeMPMCNodePool q) | 
| static void | mpmc_add_free_node (FreeMPMCNodePool q, MPMCDataNode available) | 
| static MPMCQueue | MPMCQueueCreate (void) | 
| static void | MPMCQueueDestroy (MPMCQueue Q) | 
| static MPMCDataNode | mpmc_get_push_node (MPMCQueue Q, unsigned int push_idx) | 
| static MPMCDataNode | mpmc_get_pop_node (MPMCQueue Q, unsigned int pull_idx) | 
| static void | mpmc_check_mem_reclamation (MPMCQueue Q, unsigned int pull_idx, MPMCDataNode node) | 
| static int | MPMCQueueEmpty (MPMCQueue Q) | 
| static int | MPMCQueueLength (MPMCQueue Q) | 
| static char * | MPMCQueueTop (MPMCQueue Q) | 
| static char * | MPMCQueuePop (MPMCQueue Q) | 
| static void | MPMCQueuePush (MPMCQueue Q, void *data) | 
| 
 Variables | 
| int | DataNodeSize | 
| int | MaxDataNodes | 
| int | QueueUpperBound | 
| int | DataNodeWrap | 
| int | QueueWrap | 
| int | messageQueueOverflow | 
This queue implementation enables a producer and a consumer to communicate via a queue. 
The queues are optimized for this situation, they don't require any operating system locks (they do require 32-bit reads and writes to be atomic.) Cautions: there can only be one producer, and one consumer. These queues cannot store null pointers.