Veritable Lasagna
An Allocator & Data Structure Library for C.
Loading...
Searching...
No Matches
vl_async_queue.c File Reference
#include "vl_async_queue.h"
#include <malloc.h>
#include <string.h>
+ Include dependency graph for vl_async_queue.c:

Functions

void vlAsyncQueueInit (vl_async_queue *queue, vl_uint16_t elementSize)
 Initializes an async queue for elements of a specified size.
 
void vlAsyncQueueFree (vl_async_queue *queue)
 Frees resources held by the queue but does not deallocate the queue structure.
 
vl_async_queuevlAsyncQueueNew (vl_uint16_t elementSize)
 Allocates and initializes a new async queue on the heap.
 
void vlAsyncQueueDelete (vl_async_queue *queue)
 Deletes a heap-allocated queue created with vlAsyncQueueNew.
 
void vlAsyncQueueClear (vl_async_queue *queue)
 Clears the queue content and resets it to its initial dummy-node state.
 
void vlAsyncQueueReset (vl_async_queue *queue)
 Resets the queue, deallocating most dynamically allocated memory.
 
void vlAsyncQueuePushBack (vl_async_queue *queue, const void *value)
 Pushes a new element to the end of the queue.
 
vl_bool_t vlAsyncQueuePopFront (vl_async_queue *queue, void *outValue)
 Pops an element from the front of the queue.
 

Function Documentation

◆ vlAsyncQueueClear()

void vlAsyncQueueClear ( vl_async_queue * queue)

Clears the queue content and resets it to its initial dummy-node state.

Parameters
queuePointer to the queue.
Note
Does not free memory but allows memory to be reused.
Not safe to call concurrently with push/pop operations; external synchronization required.
+ Here is the call graph for this function:

◆ vlAsyncQueueDelete()

void vlAsyncQueueDelete ( vl_async_queue * queue)

Deletes a heap-allocated queue created with vlAsyncQueueNew.

Parameters
queuePointer to the queue to be deleted.
+ Here is the call graph for this function:

◆ vlAsyncQueueFree()

void vlAsyncQueueFree ( vl_async_queue * queue)

Frees resources held by the queue but does not deallocate the queue structure.

Parameters
queuePointer to an initialized vl_async_queue.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlAsyncQueueInit()

void vlAsyncQueueInit ( vl_async_queue * queue,
vl_uint16_t elementSize )

Initializes an async queue for elements of a specified size.

Parameters
queuePointer to an uninitialized vl_async_queue structure.
elementSizeSize in bytes of each element stored in the queue.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vlAsyncQueueNew()

vl_async_queue * vlAsyncQueueNew ( vl_uint16_t elementSize)

Allocates and initializes a new async queue on the heap.

Parameters
elementSizeSize in bytes of each element stored in the queue.
Returns
Pointer to the newly allocated vl_async_queue.
+ Here is the call graph for this function:

◆ vlAsyncQueuePopFront()

vl_bool_t vlAsyncQueuePopFront ( vl_async_queue * queue,
void * result )

Pops an element from the front of the queue.

Parameters
queuePointer to the queue.
resultPointer to the buffer where the popped value will be written (must be elementSize bytes).
Returns
VL_TRUE if an element was dequeued, VL_FALSE if the queue was empty.
Note
Safe to call concurrently from multiple threads.
+ Here is the call graph for this function:

◆ vlAsyncQueuePushBack()

void vlAsyncQueuePushBack ( vl_async_queue * queue,
const void * value )

Pushes a new element to the end of the queue.

Parameters
queuePointer to the queue.
valuePointer to the data to enqueue (must be elementSize bytes).
Note
Safe to call concurrently from multiple threads.
+ Here is the call graph for this function:

◆ vlAsyncQueueReset()

void vlAsyncQueueReset ( vl_async_queue * queue)

Resets the queue, deallocating most dynamically allocated memory.

Parameters
queuePointer to the queue.
Note
Leaves the queue in an initialized but empty state.
Not safe to call concurrently with push/pop operations; external synchronization required.
+ Here is the call graph for this function: