📄 pool.h
字号:
/* -*- c-file-style: "img" -*-
<module>
* Name : pool.h
* Title : Object Pool Memory Allocator
* Author : Marcus Shawcroft
* Created : 14 May 2003
*
* Copyright : 2003 by Imagination Technologies Limited.
* All rights reserved. No part of this software, either
* material or conceptual may be copied or distributed,
* transmitted, transcribed, stored in a retrieval system
* or translated into any human or computer language in any
* form by any means, electronic, mechanical, manual or
* other-wise, or disclosed to third parties without the
* express written permission of Imagination Technologies
* Limited, Unit 8, HomePark Industrial Estate,
* King's Langley, Hertfordshire, WD4 8LZ, U.K.
*
* Description :
*
* Implements an object pool memory manager.
*
* Platform : ALL
*
</module>
*/
#ifndef _POOL_H_
#define _POOL_H_
typedef struct _POOL_ POOL;
#if defined (__cplusplus)
extern "C" {
#endif
/*----------------------------------------------------------------------------
<function>
FUNCTION: POOL_Create
PURPOSE:
Create an object pool.
PARAMETERS: In: name - name of object pool for diagnostic purposes.
In: uSize - size of each object in the pool in bytes.
RETURNS: IMG_NULL or object pool handle.
</function>
-----------------------------------------------------------------------------*/
POOL *
POOL_Create (const char *name, IMG_SIZE_T uSize);
/*----------------------------------------------------------------------------
<function>
FUNCTION: POOL_Delete
PURPOSE:
Delete an object pool. All objects allocated from the pool must
be free'd with pool_free() before deleting the object pool.
PARAMETERS: In: pPool - object pool pointer.
RETURNS: None.
</function>
-----------------------------------------------------------------------------*/
void
POOL_Delete (POOL *pPool);
/*----------------------------------------------------------------------------
<function>
FUNCTION: POOL_Alloc
PURPOSE:
Allocate an object from an object pool.
PARAMETERS: In: pPool - object pool.
RETURNS: object pointer, or IMG_NULL.
</function>
-----------------------------------------------------------------------------*/
void *
POOL_Alloc (POOL *pPool);
/*----------------------------------------------------------------------------
<function>
FUNCTION: POOL_Free
PURPOSE:
Free an object previously allocated from an object pool.
PARAMETERS: In: pPool - object pool pointer.
In: pObject - object pointer
RETURNS: None.
</function>
-----------------------------------------------------------------------------*/
void
POOL_Free (POOL *pPool, void *pObject);
#if defined (__cplusplus)
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -