ThreadObject Class Reference

A Thread Object which works on all our supported OSes. More...

#include <thread.h>

Inheritance diagram for ThreadObject:

ThreadObject_MorphOS ThreadObject_pthread ThreadObject_Win32

Public Member Functions

virtual ~ThreadObject ()
 Virtual destructor to allow 'delete' operator to work properly.
virtual bool IsRunning ()=0
 Check if the thread is currently running.
virtual bool WaitForStop ()=0
 Waits for the thread to exit.
virtual bool Exit ()=0
 Exit this thread.
virtual void Join ()=0
 Join this thread.
virtual bool IsCurrent ()=0
 Check if this thread is the current active thread.
virtual uint GetId ()=0
 Get the unique ID of this thread.

Static Public Member Functions

static ThreadObjectNew (OTTDThreadFunc proc, void *param)
 Create a thread; proc will be called as first function inside the thread, with optinal params.
static ThreadObjectAttachCurrent ()
 Convert the current thread to a new ThreadObject.
static uint CurrentId ()
 Find the Id of the current running thread.

Detailed Description

A Thread Object which works on all our supported OSes.

Definition at line 13 of file thread.h.


Member Function Documentation

virtual bool ThreadObject::IsRunning (  )  [pure virtual]

Check if the thread is currently running.

Returns:
True if the thread is running.

Implemented in ThreadObject_MorphOS, ThreadObject_pthread, and ThreadObject_Win32.

virtual bool ThreadObject::WaitForStop (  )  [pure virtual]

Waits for the thread to exit.

Returns:
True if the thread has exited.

Implemented in ThreadObject_MorphOS, ThreadObject_pthread, and ThreadObject_Win32.

virtual bool ThreadObject::IsCurrent (  )  [pure virtual]

Check if this thread is the current active thread.

Returns:
True if it is the current active thread.

Implemented in ThreadObject_MorphOS, ThreadObject_pthread, and ThreadObject_Win32.

virtual uint ThreadObject::GetId (  )  [pure virtual]

Get the unique ID of this thread.

Returns:
A value unique to each thread.

Implemented in ThreadObject_MorphOS, ThreadObject_pthread, and ThreadObject_Win32.

ThreadObject * ThreadObject::New ( OTTDThreadFunc  proc,
void *  param 
) [static]

Create a thread; proc will be called as first function inside the thread, with optinal params.

Parameters:
proc The procedure to call inside the thread.
param The params to give with 'proc'.
Returns:
True if the thread was started correctly.

Definition at line 216 of file thread_morphos.cpp.

Referenced by GenerateWorld(), and SaveOrLoad().

ThreadObject * ThreadObject::AttachCurrent (  )  [static]

Convert the current thread to a new ThreadObject.

Returns:
A new ThreadObject with the current thread attached to it.

Definition at line 221 of file thread_morphos.cpp.

uint ThreadObject::CurrentId (  )  [static]

Find the Id of the current running thread.

Returns:
The thread ID of the current active thread.

Definition at line 226 of file thread_morphos.cpp.


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

Generated on Tue Jan 6 19:02:06 2009 for openttd by  doxygen 1.5.6