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 55 of file MemoryPool.h.
| MemoryPool | ( | ) |
Create and Initialize a memory pool.
Definition at line 62 of file MemoryPool.h.
| ~MemoryPool | ( | ) |
Destroy a memory pool.
Definition at line 78 of file MemoryPool.h.
| T* alloc | ( | void | ) |
Allocate a memory block from a memory pool, without blocking.
Definition at line 88 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 99 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 114 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 133 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 148 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 167 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 184 of file MemoryPool.h.