Scale Stack 0.3 Developer Documentation

scalestack::threading::thread Class Reference

#include <thread.h>

Inheritance diagram for scalestack::threading::thread:
scalestack::event::libevent::thread scalestack::threading::test::thread

Public Member Functions

 thread (kernel::module &module)
virtual ~thread ()
void start (void)
void stop (void)
size_t get_id (void)
virtual void run (void)=0

Protected Attributes

kernel::module_module

Private Member Functions

 thread (const thread &)
threadoperator= (const thread &)

Private Attributes

std::auto_ptr< thread_provider_thread_provider

Detailed Description

This class represents a thread that applications should derive from.

Definition at line 44 of file thread.h.


Constructor & Destructor Documentation

scalestack::threading::thread::thread ( kernel::module module  )  [inline]

This doesn't actually start the thread, derived classes must call start() when the underlying thread should be created. If this did start the thread, the run() method would most likely be started before the derived class was fully constructed.

Parameters:
[in] module Module that the thread is associated with.

Reimplemented in scalestack::threading::test::thread.

Definition at line 162 of file thread.h.

scalestack::threading::thread::~thread (  )  [inline, virtual]

Threads should be stopped first with stop() before this destructor is run, otherwise the run() method in derived classes would still be running.

Reimplemented in scalestack::event::libevent::thread.

Definition at line 169 of file thread.h.

scalestack::threading::thread::thread ( const thread  )  [private]

Don't allow copying of objects.


Member Function Documentation

void scalestack::threading::thread::start ( void   )  [inline]

Start the thread. Once this is called, the run() method can be called at any time, even before this call completes.

Definition at line 173 of file thread.h.

void scalestack::threading::thread::stop ( void   )  [inline]

Stop a thread. This will block until the run() method running in the thread completes.

Definition at line 178 of file thread.h.

size_t scalestack::threading::thread::get_id ( void   )  [inline]

Get an ID for this thread.

Definition at line 183 of file thread.h.

virtual void scalestack::threading::thread::run ( void   )  [pure virtual]

Method that implements the body of the running thread.

Implemented in scalestack::event::libevent::thread, and scalestack::threading::test::thread.

thread& scalestack::threading::thread::operator= ( const thread  )  [private]

Don't allow assignment of objects.


Field Documentation

Definition at line 89 of file thread.h.

Definition at line 103 of file thread.h.


The documentation for this class was generated from the following file:
Generated on Thu Feb 17 13:10:23 2011 by  doxygen 1.6.3