13#ifndef CDI_QUEUE_API_H__
14#define CDI_QUEUE_API_H__
26#define CDI_FIXED_QUEUE_SIZE (0)
106 void* item_dest_ptr);
127 uint32_t* ret_signal_index_ptr,
void* item_dest_ptr);
151 const void* item_ptr);
170 uint32_t* ret_signal_index_ptr,
const void* item_ptr);
This file contains the declarations for OS functions for creating/managing/freeing threads,...
struct CdiSignalType_t * CdiSignalType
Define portable signal type. Don't use void* here, which prevents the compiler from type checking.
Definition cdi_os_api.h:189
CDI_INTERFACE CdiSignalType CdiQueueGetPopWaitSignal(CdiQueueHandle handle)
Definition queue.c:540
CDI_INTERFACE bool CdiQueuePush(CdiQueueHandle handle, const void *item_ptr)
Definition queue.c:417
CDI_INTERFACE void CdiQueueDestroy(CdiQueueHandle handle)
Definition queue.c:579
CDI_INTERFACE void CdiQueueFlush(CdiQueueHandle handle)
Definition queue.c:515
CdiQueueSignalMode
This enumeration is used in the internal queue structure to indicate the type of OS signals,...
Definition cdi_queue_api.h:38
@ kQueueSignalPushWait
In this mode, use CdiQueuePushWait() to block and wait on a full queue. Use CdiQueueGetPushWaitSignal...
Definition cdi_queue_api.h:47
@ kQueueMultipleWritersFlag
Optional flag to add locking for thread safe pushing into the queue.
Definition cdi_queue_api.h:53
@ kQueueSignalNone
In this mode signals are not used.
Definition cdi_queue_api.h:39
@ kQueueSignalPopWait
In this mode, use CdiQueuePopWait() to block and wait on an empty queue. Use CdiQueueGetPopWaitSignal...
Definition cdi_queue_api.h:43
@ kQueueSignalPopPushWait
In this mode, signals are enabled for both push and pop operations (see above).
Definition cdi_queue_api.h:49
@ kQueueSignalModeMask
Mask that only includes the main mode options. Used for ignoring option flags.
Definition cdi_queue_api.h:51
CDI_INTERFACE bool CdiQueuePopWait(CdiQueueHandle handle, int timeout_ms, CdiSignalType abort_wait_signal, void *item_dest_ptr)
Definition queue.c:389
CDI_INTERFACE bool CdiQueuePop(CdiQueueHandle handle, void *item_dest_ptr)
Definition queue.c:338
CDI_INTERFACE CdiSignalType CdiQueueGetPushWaitSignal(CdiQueueHandle handle)
Definition queue.c:528
CDI_INTERFACE bool CdiQueueCreate(const char *name_str, uint32_t item_count, uint32_t grow_count, uint32_t max_grow_count, uint32_t item_byte_size, CdiQueueSignalMode signal_mode, CdiQueueHandle *ret_handle_ptr)
Creates a queue. Memory is allocated by this function.
Definition queue.c:266
CDI_INTERFACE const char * CdiQueueGetName(CdiQueueHandle handle)
Definition queue.c:552
void(* CdiQueueCallback)(const CdiQueueCbData *data_ptr)
Definition cdi_queue_api.h:233
CDI_INTERFACE bool CdiQueuePopWaitMultiple(CdiQueueHandle handle, int timeout_ms, CdiSignalType *abort_wait_signal_array, int num_signals, uint32_t *ret_signal_index_ptr, void *item_dest_ptr)
Definition queue.c:394
CDI_INTERFACE bool CdiQueueIsEmpty(CdiQueueHandle handle)
Definition queue.c:521
CDI_INTERFACE bool CdiQueuePushWaitMultiple(CdiQueueHandle handle, int timeout_ms, CdiSignalType *abort_wait_signal_array, int num_signals, uint32_t *ret_signal_index_ptr, const void *item_ptr)
Definition queue.c:487
CDI_INTERFACE bool CdiQueuePushWait(CdiQueueHandle handle, int timeout_ms, CdiSignalType abort_wait_signal, const void *item_ptr)
Definition queue.c:482
struct CdiQueueState * CdiQueueHandle
Type used as the handle (pointer to an opaque structure) for a queue. Each handle represents a instan...
Definition cdi_queue_api.h:32
#define CDI_INTERFACE
Specify C linkage when compiling as C++ and define API interface export for Windows.
Definition cdi_utility_api.h:34
A structure of this type is passed as the parameter to CdiQueueCallback(). It contains the state of a...
Definition cdi_queue_api.h:218
bool is_pop
True if read triggered the callback, otherwise a write triggered it.
Definition cdi_queue_api.h:219
CdiSinglyLinkedListEntry * read_ptr
Current read pointer in the queue.
Definition cdi_queue_api.h:220
CdiSinglyLinkedListEntry * write_ptr
Current write pointer in the queue.
Definition cdi_queue_api.h:221
void * item_data_ptr
Pointer to item data.
Definition cdi_queue_api.h:222
int occupancy
The number of entries currently enqueued.
Definition cdi_queue_api.h:223
This structure represents a single list entry.
Definition singly_linked_list_api.h:49