Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

seda_stage< In, void > Class Template Reference

Inherits seda_stage_base.

List of all members.


Detailed Description

template<class In>
class seda_stage< In, void >

A stage in a SEDA (staged, event-driven application) decomposition.

A seda_stage must always take, as input, an object of the type specified as the first template argument. (Generally a server will define a "work unit" type that includes a reference to the client socket.) If always generates a particular kind of output element, consider using the seda_stage<In, Out> construction that lets the user of your component specify a particular "next" stage.


Public Methods

 seda_stage (string name=string())
 Constructor.

virtual ~seda_stage ()
 Destructor.

void scan ()
 Periodic scan to see whether to kill a thread.

void set_nthreads (unsigned int min, unsigned int max)
 Sets the minimum and maximum number of threads (inclusive) which may be assigned to this stage.

void inject (In &in)
 Injects an element into the queue.

virtual void handle (In &in)=0
 Called on some handler thread for each input element.

virtual void clogged (In &in)
 Called when someone tries to inject an element into the queue, but there are no handlers available to service it.


Protected Methods

void add_threads ()

Friends

class my_thread


Constructor & Destructor Documentation

template<class In>
virtual seda_stage< In, void >::~seda_stage   [virtual]
 

Destructor.

Joins all active handler threads, so this will not complete until all handlers exit (this is necessary because the handler threads may invoke methods on this class).


Member Function Documentation

template<class In>
void seda_stage< In, void >::add_threads   [protected]
 

template<class In>
virtual void seda_stage< In, void >::clogged In &    in [virtual]
 

Called when someone tries to inject an element into the queue, but there are no handlers available to service it.

This is invoked on the same thread which calls inject (before inject returns) so it must return very quickly.

template<class In>
virtual void seda_stage< In, void >::handle In &    in [pure virtual]
 

Called on some handler thread for each input element.

template<class In>
void seda_stage< In, void >::inject In &    in
 

Injects an element into the queue.

template<class In>
void seda_stage< In, void >::scan   [virtual]
 

Periodic scan to see whether to kill a thread.

Implements seda_stage_base.

template<class In>
seda_stage< In, void >::seda_stage string    name = string()
 

Constructor.

template<class In>
void seda_stage< In, void >::set_nthreads unsigned int    min,
unsigned int    max
[virtual]
 

Sets the minimum and maximum number of threads (inclusive) which may be assigned to this stage.

Implements seda_stage_base.


Friends And Related Function Documentation

template<class In>
friend class my_thread [friend]
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:10 2002 for NMSTL