|
libcmutils 0.6.5
Multi-platform C99 utility library
|
Data Structures | |
| struct | CMUTIL_Pool |
| Resource pool object. More... | |
Typedefs | |
| typedef void *(* | CMPoolItemCreateCB) (void *udata) |
| Callback type for creating a pool item. | |
| typedef void(* | CMPoolItemFreeCB) (void *resource, void *udata) |
| Callback type for freeing a pool item. | |
| typedef CMBool(* | CMPoolItemTestCB) (void *resource, void *udata) |
| Callback type for testing a pool item. | |
Functions | |
| CMUTIL_Pool * | CMUTIL_PoolCreate (int initcnt, int maxcnt, CMPoolItemCreateCB createproc, CMPoolItemFreeCB destroyproc, CMPoolItemTestCB testproc, long pinginterval, CMBool testonborrow, void *udata, CMUTIL_Timer *timer) |
| Create a resource pool with specified parameters. | |
| CMUTIL_Pool * CMUTIL_PoolCreate | ( | int | initcnt, |
| int | maxcnt, | ||
| CMPoolItemCreateCB | createproc, | ||
| CMPoolItemFreeCB | destroyproc, | ||
| CMPoolItemTestCB | testproc, | ||
| long | pinginterval, | ||
| CMBool | testonborrow, | ||
| void * | udata, | ||
| CMUTIL_Timer * | timer | ||
| ) |
Create a resource pool with specified parameters.
| initcnt | The initial number of resources in the pool. |
| maxcnt | The maximum number of resources allowed in the pool. |
| createproc | A callback function to create new resources, or NULL for a pool that never creates resources on its own. Such a pool hands out only what was put into it with AddResource, and CheckOut returns NULL once it runs empty. |
| destroyproc | A callback function to free resources, or NULL if the resources need no cleanup. |
| testproc | A callback function to test the validity of resources, or NULL to treat every resource as valid. |
| pinginterval | The interval in milliseconds to ping resources for validity. |
| testonborrow | Whether to test resources when they are checked out. |
| udata | User-defined data to be passed to callback functions. |
| timer | A timer object for scheduling resource pings. Ownership of the timer object is not transferred to the pool. If NULL, creates an internal default timer. |