LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::thread Class Reference

lti thread class. More...

#include <ltiThread.h>

Inheritance diagram for lti::thread:
Inheritance graph
[legend]
Collaboration diagram for lti::thread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 thread ()
virtual ~thread ()
virtual void start ()
virtual void stop ()
virtual void join ()
bool isAlive () const
bool representsCalledThread () const
virtual const char * getTypeName () const

Protected Member Functions

virtual void run ()=0
virtual void cleanUp ()

Detailed Description

lti thread class.

representiation of a system thread (currently a posix thread for Unix systems, and WIN32 thread for windows systems)

If you need a thread, just inherit from this class and reimplement the member run:

 class myThread : public thread {
 protected:
   void run() {
     // your thread's job here!
   }
 };

 ...

 // somewhere else in your code:

 myThread aThread;
 aThread.start(); // do your threads job...
 // continue with other things (your thread runs in parallel...)

Constructor & Destructor Documentation

lti::thread::thread (  ) 

default constructor

virtual lti::thread::~thread (  )  [virtual]

destructor.

If the thread is still executing while destroying the thread object, the thread will be forced to stop. Use join() to wait for the thread to terminate itself.


Member Function Documentation

virtual void lti::thread::cleanUp (  )  [inline, protected, virtual]

method to be called when finishing regulary or cancelling the thread; something like a destructor for the run() method

Reimplemented in lti::gtkServer::guiThread.

virtual const char* lti::thread::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::object.

bool lti::thread::isAlive (  )  const

test if the thread is alive

virtual void lti::thread::join (  )  [virtual]

wait for thread termination

bool lti::thread::representsCalledThread (  )  const

returns whether the thread object represents the called thread i.e.

true if called within the run() method.

virtual void lti::thread::run (  )  [protected, pure virtual]

method to be called when starting the thread; contains the job the thread has to execute

Implemented in lti::gtkServer::guiThread.

virtual void lti::thread::start (  )  [virtual]

start thread

Reimplemented in lti::gtkServer::guiThread.

virtual void lti::thread::stop (  )  [virtual]

forces the thread to stop executing.

overload this function to cleanup things run leaves after cancellation.

Reimplemented in lti::gtkServer::guiThread.


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

Generated on Sat Apr 10 15:28:53 2010 for LTI-Lib by Doxygen 1.6.1