Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::PoolThread Class Reference

This is the specific thread class that the thread pool uses to create the threads for itself. More...

#include <ThreadPool.h>

Inheritance diagram for VCF::PoolThread:

VCF::Thread VCF::Object VCF::Runnable VCF::Waitable List of all members.

Public Member Functions

 PoolThread (ThreadPool *owningThreadPool, uint32 index)
 This creates a thread for the pool.
virtual ~PoolThread ()
void cantContinue ()
virtual bool run ()
 This is the thread's execution method.

Public Attributes

ThreadPoolpool_
uint32 id_

Detailed Description

This is the specific thread class that the thread pool uses to create the threads for itself.


Constructor & Destructor Documentation

VCF::PoolThread::PoolThread ThreadPool owningThreadPool,
uint32  index
[inline]
 

This creates a thread for the pool.

The constructor takes a pointer to the pool the thread belongs to as well as the thread's index in the pool's thread array. Note that the thread is created with auto deletion flagged off. This means that the thread pool will completely control the lifetime of the thread and it's eventual destruction, as opposed to letting this happen automatically.

virtual VCF::PoolThread::~PoolThread  )  [inline, virtual]
 


Member Function Documentation

void VCF::PoolThread::cantContinue  )  [inline]
 

virtual bool VCF::PoolThread::run  )  [inline, virtual]
 

This is the thread's execution method.

All it does is to loop (until it can no longer continue) and wait for work items to be come available in the thread pool this thread has been assigned to. When a work item is returned, if it's non NULL, then the item's run() method is invoked within a try/catch block. After the run() method returns, the item is then deleted.

See also:
Thread::canContinue

ThreadPool::waitForWork

Runnable::run

Reimplemented from VCF::Thread.


Member Data Documentation

uint32 VCF::PoolThread::id_
 

ThreadPool* VCF::PoolThread::pool_
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information