Define and manage fixed-size memory pools of objects of a given type. More...
#include <MemoryPool.h>
Public Member Functions | |
MemoryPool () | |
Create and Initialize a memory pool. More... | |
~MemoryPool () | |
Destroy a memory pool. More... | |
T * | alloc (void) |
Allocate a memory block from a memory pool, without blocking. More... | |
T * | alloc_for (uint32_t millisec) |
Allocate a memory block from a memory pool, optionally blocking. More... | |
T * | alloc_until (uint64_t millisec) |
Allocate a memory block from a memory pool, blocking. More... | |
T * | calloc (void) |
Allocate a memory block from a memory pool, without blocking, and set memory block to zero. More... | |
T * | calloc_for (uint32_t millisec) |
Allocate a memory block from a memory pool, optionally blocking, and set memory block to zero. More... | |
T * | calloc_until (uint64_t millisec) |
Allocate a memory block from a memory pool, blocking, and set memory block to zero. More... | |
osStatus | free (T *block) |
Free a memory block. More... | |
Define and manage fixed-size memory pools of objects of a given type.
T | data type of a single object (element). |
queue_sz | maximum number of objects (elements) in the memory pool. |
Definition at line 50 of file MemoryPool.h.
MemoryPool | ( | ) |
Create and Initialize a memory pool.
Definition at line 57 of file MemoryPool.h.
~MemoryPool | ( | ) |
Destroy a memory pool.
Definition at line 73 of file MemoryPool.h.
T* alloc | ( | void | ) |
Allocate a memory block from a memory pool, without blocking.
Definition at line 83 of file MemoryPool.h.
T* alloc_for | ( | uint32_t | millisec | ) |
Allocate a memory block from a memory pool, optionally blocking.
millisec | timeout value (osWaitForever to wait forever) |
Definition at line 94 of file MemoryPool.h.
T* alloc_until | ( | uint64_t | millisec | ) |
Allocate a memory block from a memory pool, blocking.
millisec | absolute timeout time, referenced to Kernel::get_ms_count(). |
Definition at line 109 of file MemoryPool.h.
T* calloc | ( | void | ) |
Allocate a memory block from a memory pool, without blocking, and set memory block to zero.
Definition at line 128 of file MemoryPool.h.
T* calloc_for | ( | uint32_t | millisec | ) |
Allocate a memory block from a memory pool, optionally blocking, and set memory block to zero.
millisec | timeout value (osWaitForever to wait forever) |
Definition at line 143 of file MemoryPool.h.
T* calloc_until | ( | uint64_t | millisec | ) |
Allocate a memory block from a memory pool, blocking, and set memory block to zero.
millisec | absolute timeout time, referenced to Kernel::get_ms_count(). |
Definition at line 162 of file MemoryPool.h.
osStatus free | ( | T * | block | ) |
Free a memory block.
block | address of the allocated memory block to be freed. |
Definition at line 179 of file MemoryPool.h.