definitions for the thread management framework. More...
#include "common.h"
#include "config.h"
#include "collection.h"
#include "linked_list.h"
#include "hashlist.h"
#include "vector.h"
Go to the source code of this file.
Data Structures | |
struct | _cp_pooled_thread |
cp_pooled_thread is a thread that lives in a thread_pool. More... | |
struct | _cp_thread_pool |
cp_thread_pool holds a list of free threads (in wait mode). More... | |
struct | cp_pooled_thread_scheduler |
Definitions for thread management framework follow. More... | |
struct | _cp_pooled_thread_client_interface |
cp_pooled_thread_client_interface acts as the link to the cp_pooled_thread_scheduler for clients that require a variable number of threads. More... | |
Typedefs | |
typedef int(* | cp_thread_stop_fn )(void *) |
a stop function for client threads | |
typedef CPROPS_DLL struct _cp_pooled_thread | cp_pooled_thread |
cp_pooled_thread is a thread that lives in a thread_pool. | |
typedef CPROPS_DLL struct _cp_thread_pool | cp_thread_pool |
cp_thread_pool holds a list of free threads (in wait mode). | |
typedef CPROPS_DLL struct cp_pooled_thread_scheduler | cp_pooled_thread_scheduler |
Definitions for thread management framework follow. | |
typedef int | cp_pooled_thread_report_load (struct _cp_pooled_thread_client_interface *s) |
typedef void | cp_pooled_thread_shrink (struct _cp_pooled_thread_client_interface *) |
typedef CPROPS_DLL struct _cp_pooled_thread_client_interface | cp_pooled_thread_client_interface |
cp_pooled_thread_client_interface acts as the link to the cp_pooled_thread_scheduler for clients that require a variable number of threads. | |
Functions | |
long | cp_pooled_thread_get_id (cp_pooled_thread *thread) |
return a thread id for this thread | |
CPROPS_DLL cp_pooled_thread * | cp_pooled_thread_create (struct _cp_thread_pool *owner) |
thread constructor function | |
void | cp_pooled_thread_destroy (cp_pooled_thread *t) |
thread destructor | |
int | cp_pooled_thread_stop (cp_pooled_thread *t) |
signal a thread to stop | |
int | cp_pooled_thread_run_task (cp_pooled_thread *pt, cp_thread_action action, void *prm) |
sets the action and prm for this thread, then invokes 'action' | |
int | cp_pooled_thread_run_stoppable_task (cp_pooled_thread *pt, cp_thread_action action, void *action_prm, cp_thread_stop_fn stop_fn, void *stop_prm) |
perform action with stop function | |
void * | cp_pooled_thread_run (void *prm) |
framework thread function | |
cp_thread_pool * | cp_thread_pool_create (int min_size, int max_size) |
cp_thread_pool constructor | |
void | cp_thread_pool_destroy (cp_thread_pool *pool) |
cp_thread_pool destructor | |
int | cp_thread_pool_wait (cp_thread_pool *pool) |
wait for threads to finish processing client requests | |
int | cp_thread_pool_stop (cp_thread_pool *pool) |
signal all threads in this pool to stop | |
cp_thread * | cp_thread_pool_get (cp_thread_pool *pool, cp_thread_action action, void *prm) |
request a thread from the pool. | |
cp_thread * | cp_thread_pool_get_stoppable (cp_thread_pool *pool, cp_thread_action action, void *action_prm, cp_thread_stop_fn stop_fn, void *stop_prm) |
request a thread from the pool. | |
cp_thread * | cp_thread_pool_get_nb (cp_thread_pool *pool, cp_thread_action action, void *prm) |
request a thread from the pool - non-blocking version. | |
cp_thread * | cp_thread_pool_get_stoppable_nb (cp_thread_pool *pool, cp_thread_action action, void *action_prm, cp_thread_stop_fn stop_fn, void *stop_prm) |
request a thread from the pool - non-blocking version. | |
int | cp_thread_pool_count_available (cp_thread_pool *pool) |
returns the number of available threads in the pool. | |
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) |
cp_pooled_thread_client_interface constructor | |
void | cp_pooled_thread_client_interface_destroy (cp_pooled_thread_client_interface *client) |
cp_pooled_thread_client_interface destructor | |
void | cp_pooled_thread_client_negociate (cp_pooled_thread_client_interface *c) |
threads should call negociate when a change in the number of threads a client owns is required. | |
cp_pooled_thread_scheduler * | cp_pooled_thread_scheduler_create (cp_thread_pool *pool) |
cp_pooled_thread_scheduler constructor | |
void | cp_pooled_thread_scheduler_destroy (cp_pooled_thread_scheduler *scheduler) |
cp_pooled_thread_scheduler destructor | |
void | cp_pooled_thread_scheduler_register_client (cp_pooled_thread_scheduler *scheduler, cp_pooled_thread_client_interface *client) |
register client as a client of this scheduler | |
void | cp_pooled_thread_client_get (cp_pooled_thread_client_interface *c) |
convenience to abstract cp_thread_pool based implementation, see cp_pooled_thread_get and cp_pooled_thread_get_nb | |
void | cp_pooled_thread_client_get_stoppable (cp_pooled_thread_client_interface *c) |
convenience to abstract cp_thread_pool based implementation, see cp_pooled_thread_get and cp_pooled_thread_get_nb | |
void | cp_pooled_thread_client_get_nb (cp_pooled_thread_client_interface *c) |
convenience to abstract cp_thread_pool based implementation, see cp_pooled_thread_get and cp_pooled_thread_get_nb | |
void | cp_pooled_thread_client_get_stoppable_nb (cp_pooled_thread_client_interface *c) |
convenience to abstract cp_thread_pool based implementation, see cp_pooled_thread_get and cp_pooled_thread_get_nb | |
Variables | |
__BEGIN_DECLS typedef void *(* | cp_thread_action )(void *) |
a thread function |
definitions for the thread management framework.
the current implementation is based on the POSIX thread api.