tinythreadlib::Thread Class Reference

Th

#include <tinythreadlib.hpp>

Inherited by tinythreadlib::internal::ThreadImpl< ThreadMethodT >.

List of all members.

Public Member Functions

virtual ~Thread () throw ()
virtual void join ()=0 throw ()
virtual bool isRunning () const =0 throw ()

Static Public Member Functions

static void sleep (unsigned int milliseconds) throw ()
template<typename ThreadMethodT >
static Threadcreate (ThreadMethodT threadMethod, void *threadMethodParamm) throw ()

Detailed Description


Represents a thread. Use Thread::create to create a thread! This class is not designed to be a base class for client's thread classes!

Definition at line 886 of file tinythreadlib.hpp.

Constructor & Destructor Documentation

virtual tinythreadlib::Thread::~Thread (  )  throw () [inline, virtual]

Cancels the thread the hard way, if it is still running.

Definition at line 901 of file tinythreadlib.hpp.

Member Function Documentation

template<typename ThreadMethodT >
Thread * tinythreadlib::Thread::create ( ThreadMethodT  threadMethod,
void *  threadMethodParamm 
) throw () [inline, static]

Create a thread. ThreadMethodT can be almost everything which can be called like a method which returns void and takes a parameter (the threadMethodParam) of type void*. boost::bind is your friend for member functions. A boost::function<void (void*)> object can be used! Returns a pointer to a Thread object (which you have to delete to free the thread's resources) or NULL if an error occurs. It is not guaranteed, that the thread function is already running when this method returns successfully. The thread is canceled when Thread object is destructed! Recommendation: Initialize a boost::shared_ptr<Thread> (or any other appropriate smart pointer) with the returned value!

Definition at line 1064 of file tinythreadlib.hpp.

virtual bool tinythreadlib::Thread::isRunning (  )  const throw () [pure virtual]

Returns true, if the thread method is running, and false otherwise.

virtual void tinythreadlib::Thread::join (  )  throw () [pure virtual]

Wait until the thread function finishes. Does nothing, if the thread method is not running.

static void tinythreadlib::Thread::sleep ( unsigned int  milliseconds  )  throw () [inline, static]

Sleep for the specified number of milliseconds.

Definition at line 908 of file tinythreadlib.hpp.

The documentation for this class was generated from the following file:
 All Classes Files Functions Defines

Generated on Mon Apr 19 22:37:45 2010 for TinyThreadLib by  doxygen 1.6.1