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 kObject kMsgQueue; // --forward-declared in kApiDef.x.h
34
36 typedef kStatus (kCall *kMsgQueueDropFx) (kPointer receiver, kMsgQueue queue, kMsgQueueDropArgs* args);
37
47 kFx(kStatus) kMsgQueue_Construct(kMsgQueue* queue, kType itemType, kAlloc allocator);
48
57 kFx(kStatus) kMsgQueue_SetMaxSize(kMsgQueue queue, kSize size);
58
67 kFx(kStatus) kMsgQueue_SetMaxCount(kMsgQueue queue, kSize count);
68
77 kFx(kStatus) kMsgQueue_Reserve(kMsgQueue queue, kSize count);
78
91 kFx(kStatus) kMsgQueue_SetDropHandler(kMsgQueue queue, kMsgQueueDropFx onDrop, kPointer receiver);
92
108 kFx(kStatus) kMsgQueue_Add(kMsgQueue queue, void* item);
109
119 kFx(kStatus) kMsgQueue_Remove(kMsgQueue queue, void* item, k64u timeout);
120
130 kFx(kStatus) kMsgQueue_Clear(kMsgQueue queue);
131
141 kFx(kStatus) kMsgQueue_Purge(kMsgQueue queue);
142
150 kFx(kSize) kMsgQueue_Count(kMsgQueue queue);
151
159 kFx(kSize) kMsgQueue_MaxSize(kMsgQueue queue);
160
168 kFx(kSize) kMsgQueue_MaxCount(kMsgQueue queue);
169
177 kFx(kType) kMsgQueue_ItemType(kMsgQueue queue);
178
186 kFx(kSize) kMsgQueue_ItemSize(kQueue queue);
187
195 kFx(kSize) kMsgQueue_DataSize(kMsgQueue queue);
196
204 kFx(k64u) kMsgQueue_DropCount(kMsgQueue queue);
205
206 kEndHeader()
207
208 #include <kApi/Threads/kMsgQueue.x.h>
209
210 #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.
k64u
Represents a 64-bit unsigned integer.
kPointer
Represents a void pointer.
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)
Disposes any elements in the queue and sets the count of queue items to zero.
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)
Adjusts 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.
kMsgQueue
Represents a synchronized FIFO queue with an optional maximum size or count 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)
Adjusts 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.