AIStatefulTask ‐ Asynchronous, Stateful Task Scheduler library. Threads-like task objects evolving through user-defined states. |
The memory pool for all other memory pools.
DefaultMemoryPagePool is a globally accessible MemoryPagePool singleton, but with a life time equal of that of main(). The Default
-part refers to the fact that most memory pools, if not all, of a process can use this singleton as their MemoryPagePool. Unless you know what you are doing you're advised to use the default constructor and have all memory pools that are based on an utils::MemoryPagePool use AIMemoryPagePool::instance() .
DefaultMemoryPagePool must be initialized at the start of main before using anything else from statefultask.
Recommended usage,
The above line is equivalent to one of
In all cases AIMemoryPagePool::instance() becomes usable, which is currently only required when using AIStatefulTaskMutex (hence anything from filelock-task).
Fine tuning is possible by passing the constructor arguments of a MemoryPagePool to DefaultMemoryPagePool, or to derive your own class from MemoryPagePool and pass that to DefaultMemoryPagePool as template argument. For example,
where MyMPP
must be derived from utils::MemoryPagePool.
#include <DefaultMemoryPagePool.h>
Public Member Functions | |
DefaultMemoryPagePool (size_t block_size=0x8000, utils::MemoryPagePool::blocks_t minimum_chunk_size=0, utils::MemoryPagePool::blocks_t maximum_chunk_size=0) | |
Constructor with the same (default) arguments as utils::MemoryPagePool. | |
template<typename... ArgT> | |
DefaultMemoryPagePool (ArgT &&... args) | |
Static Public Member Functions | |
static utils::MemoryPagePool & | instance () |
|
inline |
Constructor to be used for non-default template parameter MPP when that class takes different arguments than utils::MemoryPagePool.
Note that MPP still must be derived from utils::MemoryPagePool.
|
inlinestatic |
Returns a reference to the default utils::MemoryPagePool.
This is the singleton that is initialized at the top of main().