| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2008, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bsyslib_resource_pool.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 12 | * $brcm_Date: 3/24/08 3:09p $ |
|---|
| 13 | * |
|---|
| 14 | * Revision History: |
|---|
| 15 | * |
|---|
| 16 | * NOTE: This module does not follow the magnum convention for BERR_Code |
|---|
| 17 | * as the return type of every function that can error out. The reason |
|---|
| 18 | * for this is that it is much more useful to return the values selected |
|---|
| 19 | * in this code. |
|---|
| 20 | * |
|---|
| 21 | * $brcm_Log: /magnum/syslib/framework/noarch/bsyslib_resource_pool.h $ |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/1 3/24/08 3:09p bandrews |
|---|
| 24 | * PR40865: Fixed |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/1 1/10/08 5:21p bandrews |
|---|
| 27 | * PR36149: Added resource pool |
|---|
| 28 | ***************************************************************************/ |
|---|
| 29 | |
|---|
| 30 | #include "bsyslib_list.h" |
|---|
| 31 | |
|---|
| 32 | #ifndef BSYSLIB_RESOURCE_POOL_H__ |
|---|
| 33 | #define BSYSLIB_RESOURCE_POOL_H__ |
|---|
| 34 | |
|---|
| 35 | /* |
|---|
| 36 | Summary: |
|---|
| 37 | */ |
|---|
| 38 | typedef struct |
|---|
| 39 | { |
|---|
| 40 | BSYSlib_List_Handle hResources; |
|---|
| 41 | BSYSlib_List_Handle hFree; |
|---|
| 42 | } BSYSlib_ResourcePool; |
|---|
| 43 | |
|---|
| 44 | /* |
|---|
| 45 | Summary: |
|---|
| 46 | */ |
|---|
| 47 | BSYSlib_ResourcePool * BSYSlib_ResourcePool_Create(void); |
|---|
| 48 | |
|---|
| 49 | /* |
|---|
| 50 | Summary: |
|---|
| 51 | */ |
|---|
| 52 | void BSYSlib_ResourcePool_Destroy(BSYSlib_ResourcePool * psPool); |
|---|
| 53 | |
|---|
| 54 | /* |
|---|
| 55 | Summary: |
|---|
| 56 | */ |
|---|
| 57 | void BSYSlib_ResourcePool_Add(BSYSlib_ResourcePool * psPool, void * pvResource); |
|---|
| 58 | |
|---|
| 59 | /* |
|---|
| 60 | Summary: |
|---|
| 61 | */ |
|---|
| 62 | void BSYSlib_ResourcePool_Remove(BSYSlib_ResourcePool * psPool, void * pvResource); |
|---|
| 63 | |
|---|
| 64 | /* |
|---|
| 65 | Summary: |
|---|
| 66 | */ |
|---|
| 67 | void * BSYSlib_ResourcePool_Acquire(BSYSlib_ResourcePool * psPool); |
|---|
| 68 | |
|---|
| 69 | /* |
|---|
| 70 | Summary: |
|---|
| 71 | */ |
|---|
| 72 | void BSYSlib_ResourcePool_Release(BSYSlib_ResourcePool * psPool, void * pvResource); |
|---|
| 73 | |
|---|
| 74 | #endif /* BSYSLIB_RESOURCE_POOL_H__ */ |
|---|
| 75 | |
|---|