14#ifndef VL_ASYNC_POOL_H
15#define VL_ASYNC_POOL_H
87typedef struct vl_async_pool
90 vl_atomic_uint32_t freeLength;
93 vl_atomic_bool_t allocatingFlag;
94 vl_atomic_uint16_t totalBlocks;
96 vl_uint16_t elementSize;
97 vl_uint16_t elementAlign;
107} vl_async_pool_header;
132VL_API
void vlAsyncPoolInitAligned(vl_async_pool* pool, vl_uint16_t elementSize, vl_uint16_t elementAlign);
143static inline void vlAsyncPoolInit(vl_async_pool* pool, vl_uint16_t elementSize)
184static inline vl_async_pool* vlAsyncPoolNew(vl_uint16_t elementSize)
VL_API void vlAsyncPoolFree(vl_async_pool *pool)
Frees the specified async pool, and all associated memory.
Definition vl_async_pool.c:88
VL_API void vlAsyncPoolInitAligned(vl_async_pool *pool, vl_uint16_t elementSize, vl_uint16_t elementAlign)
Initializes the specified async pool, with the specified alignment.
Definition vl_async_pool.c:72
VL_API void vlAsyncPoolDelete(vl_async_pool *pool)
Deinitializes and deletes the specified async pool, and all associated memory.
Definition vl_async_pool.c:108
VL_API vl_async_pool * vlAsyncPoolNewAligned(vl_uint16_t elementSize, vl_uint16_t elementAlign)
Allocates and initializes a new async pool, and specified alignment.
Definition vl_async_pool.c:101
VL_API void vlAsyncPoolReturn(vl_async_pool *pool, void *element)
Returns an element to the specified async pool.
Definition vl_async_pool.c:199
VL_API void * vlAsyncPoolTake(vl_async_pool *pool)
Takes an element from the specified async pool.
Definition vl_async_pool.c:158
VL_API void vlAsyncPoolReset(vl_async_pool *pool)
Resets the specified async pool, returning it to its state when it was first initialized.
Definition vl_async_pool.c:114
VL_API void vlAsyncPoolClear(vl_async_pool *pool)
Resets the state of all blocks and the pool, retaining memory but invalidating taken elements.
Definition vl_async_pool.c:139
VL_ATOMIC vl_tagged_ptr vl_atomic_ptr
Atomic variant of vl_tagged_ptr.
Definition vl_atomic_ptr.h:60
#define VL_DEFAULT_MEMORY_ALIGN
Default memory alignment. Defaults to maximum system word size.
Definition vl_memory.h:60
VL_UPTR_T vl_uintptr_t
Unsigned integer type suitable for expressing memory addresses.
Definition vl_numtypes.h:163