libcmutils 0.6.5
Multi-platform C99 utility library
Loading...
Searching...
No Matches
CMUTIL_Pool Struct Reference

Resource pool object. More...

Data Fields

void *(* CheckOut )(CMUTIL_Pool *pool, long millisec)
 Check out a resource from the pool.
 
void(* Release )(CMUTIL_Pool *pool, void *resource)
 Release a resource back to the pool.
 
void(* AddResource )(CMUTIL_Pool *pool, void *resource)
 Add a new resource to the pool.
 
void(* Destroy )(CMUTIL_Pool *pool)
 Destroy the resource pool and free its resources.
 

Detailed Description

Resource pool object.

Field Documentation

◆ CheckOut

void *(* CMUTIL_Pool::CheckOut) (CMUTIL_Pool *pool, long millisec)

Check out a resource from the pool.

This function retrieves a resource from the pool, waiting up to the specified number of milliseconds if no resources are currently available.

Parameters
poolThe resource pool from which to check out a resource.
millisecThe maximum time to wait for a resource, in milliseconds. A value of 0 means to return immediately if no resources are available. A negative value means to wait indefinitely.
Returns
A pointer to the checked-out resource, or NULL if no resource could be obtained within the specified time.

◆ Release

void(* CMUTIL_Pool::Release) (CMUTIL_Pool *pool, void *resource)

Release a resource back to the pool.

This function returns a previously checked-out resource back to the pool for reuse.

Parameters
poolThe resource pool to which the resource will be released.
resourceThe resource to be released back to the pool.

◆ AddResource

void(* CMUTIL_Pool::AddResource) (CMUTIL_Pool *pool, void *resource)

Add a new resource to the pool.

This function adds a new resource to the pool, increasing the total number of resources managed by the pool.

Parameters
poolThe resource pool to which the resource will be added.
resourceThe resource to be added to the pool.

◆ Destroy

void(* CMUTIL_Pool::Destroy) (CMUTIL_Pool *pool)

Destroy the resource pool and free its resources.

This function releases all resources managed by the pool and frees any associated memory. After calling this function, the pool object should not be used again.

Parameters
poolThe resource pool to be destroyed.

The documentation for this struct was generated from the following file: