cp_pooled_thread_scheduler Struct Reference

#include <thread.h>

Data Fields

 pool to operate on
cp_vector * client_list
 list of clients
int bypass
 when bypass flag set 'negociate' function becomes nop

Detailed Description

Definitions for thread management framework follow. The framework is based on the cp_thread_pool and cp_pooled_thread types.
The pooled thread scheduler interface is meant for use by clients who require a variable number of threads. Each such component should create an instance of cp_pooled_thread_client_interface and use the api functions to get threads from the underlying cp_thread_pool. Here is some example code.

 cp_pooled_thread_scheduler *main_scheduler;


 component_a_start(component_a *a, ...)
     a->scheduler_interface = 
         cp_pooled_thread_client_interface_create(main_scheduler, a, 2, 10, 
             component_a_report_load, component_a_stop_thread, 
             component_a_thread_run, a);


     for (i = 0; i < a->scheduler_interface->min; i++)

 component_b_start(component_b *b, ...)
     b->scheduler_interface = 
         cp_pooled_thread_client_interface_create(main_scheduler, b, 2, 10, 
             component_a_report_load, component_a_stop_thread, 
             component_a_thread_run, b);


     for (i = 0; i < b->scheduler_interface->min; i++)


In this example, the threads for component_a and component_b will be managed jointly, since their cp_pooled_thread_client_interface *'s have the same cp_pooled_thread_scheduler *.

See cp_pooled_thread_client_negociate for details.

Definition at line 239 of file thread.h.

The documentation for this struct was generated from the following file:
Generated on Mon Dec 5 23:00:23 2011 for cprops by  doxygen 1.4.7