Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMsgQueue.h
Go to the documentation of this file.
1
10 #ifndef K_API_MSG_QUEUE_H
11 #define K_API_MSG_QUEUE_H
12
13 #include <kApi/kApiDef.h>
14
15 kBeginHeader()
16
17
22 typedef struct kMsgQueueDropArgs
23 {
24 void* item;
25 } kMsgQueueDropArgs;
26
33 typedef k32s kMsgQueuePurgeOption;
34
36 #define kMSG_QUEUE_PURGE_OPTION_NULL (0x0)
37 #define kMSG_QUEUE_PURGE_OPTION_PRESERVE_CRITICAL (0x1)
38 #define kMSG_QUEUE_PURGE_OPTION_USE_HANDLER (0x2)
39 #define kMSG_QUEUE_PURGE_OPTION_DISPOSE_ITEMS (0x4)
40 #define kMSG_QUEUE_PURGE_OPTION_COUNT_DROPS (0x8)
41
49 typedef k32s kMsgQueueItemOption;
50
52 #define kMSG_QUEUE_ITEM_OPTION_NULL (0x0)
53 #define kMSG_QUEUE_ITEM_OPTION_CRITICAL (0x1)
54
148 //typedef kObject kMsgQueue; // --forward-declared in kApiDef.x.h
149
151 typedef kStatus (kCall *kMsgQueueDropFx) (kPointer receiver, kMsgQueue queue, kMsgQueueDropArgs* args);
152
162 kFx(kStatus) kMsgQueue_Construct(kMsgQueue* queue, kType itemType, kAlloc allocator);
163
176 kFx(kStatus) kMsgQueue_SetMaxSize(kMsgQueue queue, kSize size);
177
190 kFx(kStatus) kMsgQueue_SetMaxCount(kMsgQueue queue, kSize count);
191
206 kFx(kStatus) kMsgQueue_Reserve(kMsgQueue queue, kSize count);
207
222 kFx(kStatus) kMsgQueue_SetDropHandler(kMsgQueue queue, kMsgQueueDropFx onDrop, kPointer receiver);
223
242 kFx(kStatus) kMsgQueue_Add(kMsgQueue queue, void* item);
243
258 kFx(kStatus) kMsgQueue_AddEx(kMsgQueue queue, void* item, kMsgQueueItemOption options);
259
275 kFx(kStatus) kMsgQueue_Remove(kMsgQueue queue, void* item, k64u timeout);
276
290 kFx(kStatus) kMsgQueue_Clear(kMsgQueue queue);
291
305 kFx(kStatus) kMsgQueue_Purge(kMsgQueue queue);
306
321 kFx(kStatus) kMsgQueue_PurgeEx(kMsgQueue queue, kMsgQueuePurgeOption options);
322
332 kFx(kSize) kMsgQueue_Count(kMsgQueue queue);
333
343 kFx(kSize) kMsgQueue_MaxSize(kMsgQueue queue);
344
354 kFx(kSize) kMsgQueue_MaxCount(kMsgQueue queue);
355
365 kFx(kType) kMsgQueue_ItemType(kMsgQueue queue);
366
376 kFx(kSize) kMsgQueue_ItemSize(kQueue queue);
377
387 kFx(kSize) kMsgQueue_DataSize(kMsgQueue queue);
388
398 kFx(k64u) kMsgQueue_DropCount(kMsgQueue queue);
399
400 kEndHeader()
401
402 #include <kApi/Threads/kMsgQueue.x.h>
403
404 #endif
kMsgQueue::kMsgQueue_Remove
kStatus kMsgQueue_Remove(kMsgQueue queue, void *item, k64u timeout)
Removes an item from the queue.
kMsgQueue::kMsgQueue_SetDropHandler
kStatus kMsgQueue_SetDropHandler(kMsgQueue queue, kMsgQueueDropFx onDrop, kPointer receiver)
Sets the callback used when dropping an item.
kMsgQueue::kMsgQueue_AddEx
kStatus kMsgQueue_AddEx(kMsgQueue queue, void *item, kMsgQueueItemOption options)
Adds an item to the queue with the specified options.
kMsgQueueItemOption
Represents a set of options describing a kMsgQueue item.
k64u
Represents a 64-bit unsigned integer.
kPointer
Represents a void pointer.
kMsgQueuePurgeOption
Represents a set of kMsgQueue purge options.
kSize
Represents an unsigned integer that can store a pointer address.
kAlloc
Abstract base class for memory allocator types.
kMsgQueue::kMsgQueue_Count
kSize kMsgQueue_Count(kMsgQueue queue)
Reports the current count of queue items.
kMsgQueue::kMsgQueue_Reserve
kStatus kMsgQueue_Reserve(kMsgQueue queue, kSize count)
Reserves memory for the specified number of items.
kMsgQueue::kMsgQueue_Purge
kStatus kMsgQueue_Purge(kMsgQueue queue)
Removes and disposes all items from the queue.
kMsgQueue::kMsgQueue_MaxCount
kSize kMsgQueue_MaxCount(kMsgQueue queue)
Reports the maximum count of items in the queue.
kStatus
typedef kStatus(kCall *kMsgQueueDropFx)(kPointer receiver
Defines the signature of a callback function to handle dropped items.
kMsgQueue::kMsgQueue_SetMaxSize
kStatus kMsgQueue_SetMaxSize(kMsgQueue queue, kSize size)
Sets the maximum amount of data retained by the queue.
kMsgQueue::kMsgQueue_ItemSize
kSize kMsgQueue_ItemSize(kQueue queue)
Returns the queue element size.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kMsgQueue
Represents a synchronized FIFO queue with an optional maximum content size and/or item capacity...
kMsgQueueDropArgs
Represents arguments passed in a kMsgQueue drop callback.
Definition: kMsgQueue.h:22
kMsgQueue::kMsgQueue_DropCount
k64u kMsgQueue_DropCount(kMsgQueue queue)
Reports the count of dropped items.
kMsgQueue::kMsgQueue_DataSize
kSize kMsgQueue_DataSize(kMsgQueue queue)
Reports the current amount of data stored in the queue (in bytes).
kType
Represents metadata about a type (class, interface, or value).
kQueue
Represents a FIFO queue implemented with a dynamic array.
kStatus
Represents an error code.
kMsgQueue::kMsgQueue_Clear
kStatus kMsgQueue_Clear(kMsgQueue queue)
Removes all items from the queue.
kCall
#define kCall
kApi standard function calling convention.
Definition: kApiDef.h:17
kMsgQueue::kMsgQueue_SetMaxCount
kStatus kMsgQueue_SetMaxCount(kMsgQueue queue, kSize count)
Sets the maximum count of items retained by the queue.
kMsgQueue::kMsgQueue_MaxSize
kSize kMsgQueue_MaxSize(kMsgQueue queue)
Reports the maximum total data size of all items in the queue.
kMsgQueueDropArgs::item
void * item
Pointer to the item to be dropped.
Definition: kMsgQueue.h:24
kMsgQueue::kMsgQueue_Add
kStatus kMsgQueue_Add(kMsgQueue queue, void *item)
Adds an item to the queue.
kMsgQueue::kMsgQueue_ItemType
kType kMsgQueue_ItemType(kMsgQueue queue)
Reports the type of element stored in the queue.
kMsgQueue::kMsgQueue_Construct
kStatus kMsgQueue_Construct(kMsgQueue *queue, kType itemType, kAlloc allocator)
Constructs a kMsgQueue object.
kMsgQueue::kMsgQueue_PurgeEx
kStatus kMsgQueue_PurgeEx(kMsgQueue queue, kMsgQueuePurgeOption options)
Removes items from the queue using the specified options.