Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Thread Class Reference

Thread abstraction. More...

#include <Thread.unix.h>

Collaboration diagram for Thread:

Collaboration graph
[legend]
List of all members.

Public Methods

 Thread ()
 Default constructor.

virtual ~Thread ()
bool isActive ()
 True iff the thread is running.

virtual void * run ()=0
 Synchronously run the thread.

void * start ()
 Asynchronously run the thread. More...

void join ()
 Synchronize with the thread. More...

 Thread ()
 Default constructor.

virtual ~Thread ()
bool isActive ()
 True iff the thread is running.

virtual void * run ()=0
 Synchronously run the thread.

void * start ()
 Asynchronously run the thread.

void join ()
 Synchronize with the thread.


Friends

void * threadFunc (void *obj)
 Function to be run in OS thread. More...

DWORD threadFunc (void *obj)
 Function to be run in OS thread. More...


Detailed Description

Thread abstraction.

The Thread class abstracts from the OS dependent thread calls. Currently two versions exists: one based on WIN32 and one on POSIX MT.


Member Function Documentation

void Thread::join  
 

Synchronize with the thread.

Wait for the thread to complete.

Precondition:
Thread is started asynchronously.
Postcondition:
OS thread has ended.

void * Thread::start  
 

Asynchronously run the thread.

Creates a OS thread and call Thread::run in it.

Precondition:
none.
Postcondition:
  • A OS thread has been created.
  • active == true.


Friends And Related Function Documentation

DWORD threadFunc void *    obj [friend]
 

Function to be run in OS thread.

Runs the Thread::run method in a seperate thread.

See also:
Thread::run
Parameters:
obj  Thread this pointer cast to void*.
Precondition:
  • obj->mutex has been locked before thread creation.
  • obj->active == true.
Postcondition:
  • obj->mutex is released.
  • obj->active == false.
Returns:
Returns the value that Thread::run returns.

void* threadFunc void *    obj [friend]
 

Function to be run in OS thread.

Runs the Thread::run method in a seperate thread.

See also:
Thread::run
Parameters:
obj  Thread this pointer cast to void*.
Precondition:
  • obj->mutex has been locked before thread creation.
  • obj->active == true.
Postcondition:
  • obj->mutex is released.
  • obj->active == false.
Returns:
Returns the value that Thread::run returns.


The documentation for this class was generated from the following files:
This documentation was generated using doxygen. If you have any comments or additions please mail me.