Go to the source code of this file.
Functions | |
void | hipcQueueInit (struct HIPC_queue *const que_p, void *const buf_p, const size_t item_size, const size_t n_slot) |
Initializes a queue. More... | |
size_t | hipcQueueItemSize (struct HIPC_queue *const que_p) |
Gets item size. More... | |
void * | hipcQueueEmpty (struct HIPC_queue *const que_p) |
Returns an address of the head item if it exists. More... | |
void | hipcQueuePop (struct HIPC_queue *const que_p) |
Pops an item and releases a slot. More... | |
void * | hipcQueueFull (struct HIPC_queue const *const que_p) |
Returns an address of an empty slot if it exists. More... | |
void | hipcQueuePush (struct HIPC_queue *const que_p) |
Pushes an item and occupies a slot. More... | |
void | hipcQueueClear (struct HIPC_queue *const que_p) |
Clears a queue. More... | |
void hipcQueueInit | ( | struct HIPC_queue *const | que_p, |
void *const | buf_p, | ||
const size_t | item_size, | ||
const size_t | n_slot | ||
) |
Initializes a queue.
que_p | pointer to a queue |
buf_p | a buffer whose size must be item_size multiplied by n_slot |
item_size | size of an item |
n_slot | number of slots |
Definition at line 12 of file queue.c.
References HIPC_queue::buf_p, HIPC_queue::head, HIPC_MEM_BARRIER, HIPC_queue::item_size, HIPC_queue::n_slot, and HIPC_queue::tail.
size_t hipcQueueItemSize | ( | struct HIPC_queue *const | que_p | ) |
Gets item size.
que_p | pointer to a queue |
Definition at line 32 of file queue.c.
References HIPC_queue::item_size.
void* hipcQueueEmpty | ( | struct HIPC_queue *const | que_p | ) |
Returns an address of the head item if it exists.
que_p | pointer to a queue |
NULL
when the queue is empty, otherwise an address of an item to be popped is returned. Definition at line 44 of file queue.c.
References HIPC_queue::buf_p, HIPC_queue::head, HIPC_queue::item_size, and HIPC_queue::tail.
void hipcQueuePop | ( | struct HIPC_queue *const | que_p | ) |
Pops an item and releases a slot.
Before each pop, it must be checked that a queue is not empty by hipcQueueEmpty().
que_p | pointer to a queue |
Definition at line 61 of file queue.c.
References HIPC_queue::head, HIPC_MEM_BARRIER, and HIPC_queue::n_slot.
void* hipcQueueFull | ( | struct HIPC_queue const *const | que_p | ) |
Returns an address of an empty slot if it exists.
que_p | pointer to a queue |
NULL
when the queue is full, otherwise an address of an item to be pushed is returned. Definition at line 76 of file queue.c.
References HIPC_queue::buf_p, HIPC_queue::head, HIPC_queue::item_size, HIPC_queue::n_slot, and HIPC_queue::tail.
void hipcQueuePush | ( | struct HIPC_queue *const | que_p | ) |
Pushes an item and occupies a slot.
Before each push, it must be checked that a queue is not full by hipcQueueFull().
que_p | pointer to a queue |
Definition at line 93 of file queue.c.
References HIPC_MEM_BARRIER, HIPC_queue::n_slot, and HIPC_queue::tail.
void hipcQueueClear | ( | struct HIPC_queue *const | que_p | ) |
Clears a queue.
Only a consumer, not a producer, should call this function because the consumer may still use a slot.
que_p | pointer to a queue |
Definition at line 108 of file queue.c.
References HIPC_queue::head, HIPC_MEM_BARRIER, and HIPC_queue::tail.