Dv::Thread::Factory Class Reference

#include <pool.h>

Inheritance diagram for Dv::Thread::Factory:
Inheritance graph
[legend]
Collaboration diagram for Dv::Thread::Factory:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Factory (size_t max_threads, const std::string &name, unsigned int min_debug_level=0, Debugable *debug_master=0)
 Create a new factory with assciated pool.
virtual ~Factory ()
Poolpool ()
size_t size () const
size_t slack () const

Protected Member Functions

virtual Pool::Threadcreate ()=0
 Create a new Thread.
bool initialize (time_t millisecs=5000)
 Initialize the pool of this factory.
bool finalize (time_t millisecs=5000)
 Finalize the pool of this factory.

Private Attributes

Pool pool_

Friends

class Pool

Constructor & Destructor Documentation

Dv::Thread::Factory::Factory ( size_t  max_threads,
const std::string &  name,
unsigned int  min_debug_level = 0,
Debugable debug_master = 0 
) [inline]

Create a new factory with assciated pool.

The constructor of the user's class derived from this class should call Dv::Thread::Factory::initialize, see the comments for Dv::Thread::Pool::initialize.

Parameters:
max_threads number of threads that will be kept in the pool.
name for the pool's monitor.
min_debug_level if a debug_master is connected, logging info will only be written if the master's level is at least min_debug_level
debug_master from where debug info will be taken
See also:
Dv::DebugSlave
Dv::Thread::Pool::initialize
virtual Dv::Thread::Factory::~Factory (  )  [inline, virtual]

References FUNCTION_S, and Dv::Debugable::log().


Member Function Documentation

Pool& Dv::Thread::Factory::pool (  )  [inline]

References pool_.

Referenced by finalize(), and initialize().

size_t Dv::Thread::Factory::size (  )  const [inline]

References pool_, and Dv::Thread::Pool::size().

size_t Dv::Thread::Factory::slack (  )  const [inline]
Returns:
the number of threads that are currently waiting for work.

References pool_, and Dv::Thread::Pool::slack().

virtual Pool::Thread* Dv::Thread::Factory::create (  )  [protected, pure virtual]

Create a new Thread.

Returns:
a newly create thread, must not return 0
bool Dv::Thread::Factory::initialize ( time_t  millisecs = 5000  )  [inline, protected]

Initialize the pool of this factory.

See also:
Dv::Thread::Pool::initialize

References Dv::Thread::Pool::initialize(), and pool().

bool Dv::Thread::Factory::finalize ( time_t  millisecs = 5000  )  [inline, protected]

Finalize the pool of this factory.

See also:
Dv::Thread::Pool::finalize

References Dv::Thread::Pool::finalize(), and pool().


Friends And Related Function Documentation

friend class Pool [friend]

Member Data Documentation

Referenced by pool(), size(), and slack().


The documentation for this class was generated from the following file:

dvthread-0.13.4 [11 December, 2009]