10 #ifndef K_API_MSG_QUEUE_H
11 #define K_API_MSG_QUEUE_H
34 #define kMSG_QUEUE_PURGE_OPTION_NULL (0x0)
35 #define kMSG_QUEUE_PURGE_OPTION_PRESERVE_CRITICAL (0x1)
36 #define kMSG_QUEUE_PURGE_OPTION_USE_HANDLER (0x2)
37 #define kMSG_QUEUE_PURGE_OPTION_DISPOSE_ITEMS (0x4)
38 #define kMSG_QUEUE_PURGE_OPTION_COUNT_DROPS (0x8)
47 typedef k32s kMsgQueueItemOption;
50 #define kMSG_QUEUE_ITEM_OPTION_NULL (0x0)
51 #define kMSG_QUEUE_ITEM_OPTION_CRITICAL (0x1)
55 typedef kStatus (kCall *kMsgQueueDropFx) (kPointer receiver, kMsgQueue queue, kMsgQueueDropArgs* args);
57 #include <kApi/Threads/kMsgQueue.x.h>
256 #define kMsgQueue_AddT(kMsgQueue_queue, TPtr_item) \
257 xkMsgQueue_AddT(kMsgQueue_queue, TPtr_item, sizeof(*(TPtr_item)))
288 #define kMsgQueue_AddExT(kMsgQueue_queue, TPtr_item, kMsgQueueItemOption_options) \
289 xkMsgQueue_AddExT(kMsgQueue_queue, TPtr_item, kMsgQueueItemOption_options, sizeof(*(TPtr_item)))
320 #define kMsgQueue_RemoveT(kMsgQueue_queue, TPtr_item, k64u_timeout) \
321 xkMsgQueue_RemoveT(kMsgQueue_queue, TPtr_item, k64u_timeout, sizeof(*(TPtr_item)))
kStatus kMsgQueue_Remove(kMsgQueue queue, void *item, k64u timeout)
Removes an item from the queue.
kStatus kMsgQueue_SetDropHandler(kMsgQueue queue, kMsgQueueDropFx onDrop, kPointer receiver)
Sets the callback used when dropping an item.
kStatus kMsgQueue_AddEx(kMsgQueue queue, void *item, kMsgQueueItemOption options)
Adds an item to the queue with the specified options.
Represents a set of options describing a kMsgQueue item.
Represents a 64-bit unsigned integer.
Represents a void pointer.
Represents a set of kMsgQueue purge options.
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
kSize kMsgQueue_Count(kMsgQueue queue)
Reports the current count of queue items.
kStatus kMsgQueue_Reserve(kMsgQueue queue, kSize count)
Reserves memory for the specified number of items.
kStatus kMsgQueue_Purge(kMsgQueue queue)
Removes and disposes all items from the queue.
kSize kMsgQueue_MaxCount(kMsgQueue queue)
Reports the maximum count of items in the queue.
kStatus kMsgQueue_SetMaxSize(kMsgQueue queue, kSize size)
Sets the maximum amount of data retained by the queue.
kSize kMsgQueue_ItemSize(kQueue queue)
Returns the queue element size.
Core Zen type declarations.
Represents a 32-bit signed integer.
Represents a synchronized FIFO queue with an optional maximum content size and/or item capacity...
Represents arguments passed in a kMsgQueue drop callback.
Definition: kMsgQueue.h:20
k64u kMsgQueue_DropCount(kMsgQueue queue)
Reports the count of dropped items.
kSize kMsgQueue_DataSize(kMsgQueue queue)
Reports the current amount of data stored in the queue (in bytes).
Represents metadata about a type (class, interface, or value).
Represents a FIFO queue implemented with a dynamic array.
Represents an error code.
kStatus kMsgQueue_Clear(kMsgQueue queue)
Removes all items from the queue.
kStatus kMsgQueue_SetMaxCount(kMsgQueue queue, kSize count)
Sets the maximum count of items retained by the queue.
kSize kMsgQueue_MaxSize(kMsgQueue queue)
Reports the maximum total data size of all items in the queue.
void * item
Pointer to the item to be dropped.
Definition: kMsgQueue.h:22
kStatus kMsgQueue_Add(kMsgQueue queue, void *item)
Adds an item to the queue.
kType kMsgQueue_ItemType(kMsgQueue queue)
Reports the type of element stored in the queue.
kStatus kMsgQueue_Construct(kMsgQueue *queue, kType itemType, kAlloc allocator)
Constructs a kMsgQueue object.
kStatus kMsgQueue_PurgeEx(kMsgQueue queue, kMsgQueuePurgeOption options)
Removes items from the queue using the specified options.