QP/C
Functions
qmp_init.c File Reference

QMPool_init() implementation. More...

#include "qf_pkg.h"
#include "qassert.h"

Go to the source code of this file.

Functions

void QMPool_init (QMPool *me, void *poolSto, uint32_t poolSize, QMPoolSize blockSize)
 Initializes the native QF event pool.

Detailed Description

QMPool_init() implementation.

Definition in file qmp_init.c.


Function Documentation

void QMPool_init ( QMPool me,
void *  poolSto,
uint32_t  poolSize,
QMPoolSize  blockSize 
)

Initializes the native QF event pool.

The parameters are as follows: me points to the QMPool struct to be initialized, poolSto is the pool storage, poolSize is the size of the pool storage in bytes, and blockSize is the block size of this pool.

The caller of this method must make sure that the poolSto pointer is properly aligned. In particular, it must be possible to efficiently store a pointer at the location pointed to by poolSto. Internally, the QMPool_init() function rounds up the block size blockSize so that it can fit an integer number of pointers. This is done to achieve proper alignment of the blocks within the pool.

Note:
Due to the rounding of block size the actual capacity of the pool might be less than (poolSize / blockSize). You can check the capacity of the pool by calling the QF_getPoolMargin() function.

Definition at line 40 of file qmp_init.c.

References Q_ASSERT, Q_REQUIRE, QF_PTR_AT_, QS_BEGIN_, QS_CRIT_STAT_, QS_END_, QS_mpObj_, QS_OBJ_, and QS_QF_MPOOL_INIT.