src/misc/pool.h File Reference

Pool allocator interface. More...

#include <misc/result.h>

Go to the source code of this file.

Defines

#define TXC_POOL_OBJECT_FREE   0x1
#define TXC_POOL_OBJECT_ALLOCATED   0x2

Typedefs

typedef txc_pool_object_s txc_pool_object_t
typedef txc_pool_s txc_pool_t
typedef void(*) txc_pool_object_constructor_t (void *obj)
typedef void(*) txc_pool_object_print_t (void *obj)

Functions

txc_result_t txc_pool_create (txc_pool_t **poolp, unsigned int obj_size, unsigned int obj_num, txc_pool_object_constructor_t obj_constructor)
txc_result_t txc_pool_destroy (txc_pool_t **poolp)
txc_result_t txc_pool_object_alloc (txc_pool_t *pool, void **objp, int lock)
void txc_pool_object_free (txc_pool_t *pool, void **objp, int lock)
txc_pool_object_ttxc_pool_object_first (txc_pool_t *pool, int obj_status)
txc_pool_object_ttxc_pool_object_next (txc_pool_object_t *obj)
void * txc_pool_object_of (txc_pool_object_t *obj)
void txc_pool_lock (txc_pool_t *pool)
void txc_pool_unlock (txc_pool_t *pool)
void txc_pool_print (txc_pool_t *pool, txc_pool_object_print_t printer, int verbose)


Detailed Description

Pool allocator interface.

This allocator is used by library subsystems that need to preallocate and preinitialize a pool of objects.

Todo:
Consider a scalable multithreaded generic allocator such as Hoard.

Definition in file pool.h.


Typedef Documentation

typedef struct txc_pool_object_s txc_pool_object_t

The pool works as a slab allocator. That is when allocating an objects you can assume that its state is the same as when the object was returned back to the pool.

Objects are allocated from the head

Definition at line 28 of file pool.h.


Generated on Wed Dec 9 20:32:40 2009 for xCalls by  doxygen 1.4.7