<< Previous | Next >>

pool_link

int pool_link( Pool_t * p, int link );

Description

Tell the specified pool to maintain a doubly-linked list of allocated elements.

This function should only be called when the pool is completely free; i.e.,

   

 pavail() == pnel()

Parameters

p
Pool handle structure, as previously passed to pool_init() or pool_xinit().

link
Must be one of the following:

  • POOL_NOT_LINKED (0): the pool is not to be linked.

  • POOL_LINKED_AUTO (1): the pool is linked, and newly allocated elements are always added at the end of the list.

  • POOL_LINKED_BY_APP (2): the pool is linked, but newly allocated elements are not added to the list. The application must call preorder() or pmovebetween() to insert the element. This option is only available for root pools.

WARNING: if you set the POOL_LINKED_BY_APP option, then the allocated element must NOT be passed to any other pool API function except for pfree(), preorder() (as the "e" parameter) or pmovebetween() (as the "e" parameter). After calling preorder() or pmovebetween(), then it is safe to pass this element to all appropriate functions.

Return value

Currently always zero. If you define the macro POOL_DEBUG, then parameters are checked. If the parameters look bad, then an exception is raised. You can define POOL_VERBOSE to get printf() messages.

Library

POOL.LIB

See Also

pool_init, pool_xinit, pavail


Dynamic C Functions << Previous | Next >> rabbit.com