cp_pooled_thread_client_interface(3)

cp_thread_pool(3) libcprops - cp_thread_pool cp_thread_pool(3)

NAME

cp_pooled_thread_client_interface - an interface for thread pool clients

SYNOPSIS

#include <cprops/thread.h>

cp_pooled_thread_client_interface * cp_pooled_thread_client_interface_create( cp_pooled_thread_scheduler *owner, void *client, int min_threads, int max_threads, cp_pooled_thread_report_load report_load, cp_pooled_thread_shrink shrink, cp_thread_action action, void *action_prm, cp_thread_stop_fn stop_fn, void *stop_prm);

void cp_pooled_thread_client_interface_destroy( cp_pooled_thread_client_interface *client);

void cp_pooled_thread_client_get_nb( cp_pooled_thread_client_interface *client);

void cp_pooled_thread_client_get( cp_pooled_thread_client_interface *client);

void cp_pooled_thread_client_get_stoppable_nb( cp_pooled_thread_client_interface *client);

void cp_pooled_thread_client_get_stoppable( cp_pooled_thread_client_interface *client);

void cp_pooled_thread_client_negociate( cp_pooled_thread_client_interface *client);

DESCRIPTION

cp_pooled_thread_client_interface associates an action (thread function) with a cp_pooled_thread_scheduler for clients that require a variable number of threads. This interface holds 3 functions pointers that must be supplied by client code:


o report_load - should return a measure of the load for this client's action, such as the number of open requests the client has to handle
o shrink - will be called by the framework to stop one client thread
o action - the thread function for this client

application code should call the cp_pooled_thread_client_get* functions to instantiate threads, thereby activating the load balancing framework.

cp_pooled_thread_client_negociate should be called by client code on high loads to request additional threads from the framework.

SEE ALSO

cp_thread(3), cp_thread_pool(3), cp_pooled_thread_scheduler(3)

OCTOBER 2005 libcprops