LDK::Thread Class Reference

A thread of execution. More...

#include <LDK/Threading.h>

Collaboration diagram for LDK::Thread:

Collaboration graph
[legend]

Public Member Functions

 Thread ()
 Constructor. Does not start the thread.
virtual ~Thread ()
virtual void run ()=0
bool isRunning ()
void start ()
void kill ()

Protected Types

typedef void * ThreadHandle

Protected Member Functions

 Thread (const Thread &rhs)
 May not be copied.
void operator= (const Thread &rhs)
 May not be assigned to.

Static Protected Member Functions

static void runThread (void *self)

Protected Attributes

ThreadHandle mHandle
Mutex mMutex
volatile bool mRunning

Detailed Description

A very simple thread class. On windows uses _beginthread(), so it's safe to use all the c-runtime library functions inside threads, providing you define _MT on the commandline. On unix make sure _REENTRANT is defined on the commandline. With mingw I do both just to be safe. On unix it is created detached, so it behaves like a windows thread.

Definition at line 92 of file Threading.h.


Constructor & Destructor Documentation

virtual LDK::Thread::~Thread (  )  [virtual]

Destructor. Blocks until the thread has finished running, is canceled, or throws an exception.


Member Function Documentation

virtual void LDK::Thread::run (  )  [pure virtual]

Override this: it is the 'main' for the thread. May throw exceptions safely (though the thread will be terminated).

bool LDK::Thread::isRunning (  )  [inline]

Test if this Thread is running.

Returns:
True if running, false if not.

Definition at line 126 of file Threading.h.

void LDK::Thread::start (  ) 

Starts this Thread running.

Exceptions:
ThreadError if the thread is already running.

void LDK::Thread::kill (  ) 

Kills this thread (not the current thread). Very Nasty (tm). On windows it leaks everything and leaves dlls in ram :( On unix it is unlikely to cause C++ destructors to be called.


The documentation for this class was generated from the following file:
Generated on Fri Aug 17 18:32:27 2007 for LDK by  doxygen 1.5.1