◆ fiftyoneDegreesPoolResourceCreate
| typedef void*(* fiftyoneDegreesPoolResourceCreate) (fiftyoneDegreesPool *pool, void *state, fiftyoneDegreesException *exception) |
Used to create a new resource for use in the pool.
- Parameters
-
- pool - to create the resource for
- state - pointer to data used by the method
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h
- Returns
- pointer to the new resource
◆ fiftyoneDegreesPoolResourceFree
typedef void(* fiftyoneDegreesPoolResourceFree) (fiftyoneDegreesPool *pool, void *resource) Frees a resource previously created with fiftyoneDegreesPoolResourceCreate.
- Parameters
-
- pool - containing the resource
- resource - to free
◆ fiftyoneDegreesPoolResourceSize
typedef size_t(* fiftyoneDegreesPoolResourceSize) (void *state) Used to determine the additional size beyond the pointer used for each resource added to the pool.
- Parameters
-
- state - pointer to a state containing the resource and any additional data needed for the calculation
- Returns
- addition size to allocate per resource
Function Documentation
◆ fiftyoneDegreesPoolFree()
void fiftyoneDegreesPoolFree ( fiftyoneDegreesPool * pool ) Releases the items used by the pool freeing the resources used by each item by calling the resourceFree method provided when the pool was created.
- Parameters
-
- pool - to be freed
◆ fiftyoneDegreesPoolInit()
fiftyoneDegreesPool* fiftyoneDegreesPoolInit ( fiftyoneDegreesPool * pool, uint16_t concurrency, void * state, fiftyoneDegreesPoolResourceCreate resourceCreate, fiftyoneDegreesPoolResourceFree resourceFree, fiftyoneDegreesException * exception ) Initialises a pool data structure to support the number of concurrent requests that can be made to the pool for resources that can be reused.
The resourceCreate method is used to create a new resource for use in the pool which will be freed during when the release method is called on the pool using the resourceFree method.
- Parameters
-
- pool - data structure to be initialised.
- concurrency - the number of resources the pool should contain.
- state - passed to the create resource method.
- resourceCreate - method used to create the resource to be added to items in the pool.
- resourceFree - method used to free a resource from the pool when the pool is freed.
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h.
- Returns
- a pointer to the pool if successful, otherwise NULL.
◆ fiftyoneDegreesPoolItemGet()
fiftyoneDegreesPoolItem* fiftyoneDegreesPoolItemGet ( fiftyoneDegreesPool * pool, fiftyoneDegreesException * exception ) Gets the next free item from the pool for exclusive use by the caller.
Every item returned must be released when the caller has finished with it using the fiftyoneDegreesPoolItemRelease method.
- Parameters
-
- pool - to return items from.
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h.
- Returns
- the next free item, or NULL if no items are available.
◆ fiftyoneDegreesPoolItemRelease()
void fiftyoneDegreesPoolItemRelease ( fiftyoneDegreesPoolItem * item ) Releases the item back to the pool it belongs ready to be reused by another operation.
- Parameters
-
- item - to be released back to the pool
◆ fiftyoneDegreesPoolReset()
void fiftyoneDegreesPoolReset ( fiftyoneDegreesPool * pool ) Resets the pool without releasing any resources.
- Parameters
-
- pool - to be reset
