Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::GThread Class Reference

Platform independent thread implementation. More...

#include <GThread.h>

Inherits G3D::ReferenceCountedObject.

List of all members.

Public Member Functions

bool completed ()
const std::string & name ()
void ReferenceCountedObject_zeroWeakPointers ()
bool running ()
bool start ()
void terminate ()
virtual void threadMain ()=0
void waitForCompletion ()
virtual ~GThread ()

Static Public Member Functions

static GThreadRef create (const std::string &name, void(*proc)())

Public Attributes

AtomicInt32 ReferenceCountedObject_refCount
_WeakPtrLinkedListReferenceCountedObject_weakPointer

Protected Member Functions

 GThread (const std::string &name)

Friends

class _internal::GThreadPrivate


Detailed Description

Platform independent thread implementation.

You can either subclass and override GThread::threadMain or call the create method with a method.

Beware of reference counting and threads. If circular references exist between GThread subclasses then neither class will ever be deallocated. Also, dropping all pointers (and causing deallocation) of a GThread does NOT stop the underlying process.

See also:
G3D::GMutex, G3D::AtomicInt32


Constructor & Destructor Documentation

G3D::GThread::GThread ( const std::string &  name  )  [protected]

virtual G3D::GThread::~GThread (  )  [virtual]


Member Function Documentation

bool G3D::GThread::completed (  ) 

Returns completed status of thread.

static GThreadRef G3D::GThread::create ( const std::string &  name,
void(*)()  proc 
) [static]

Constructs a basic GThread without requiring a subclass.

Parameters:
proc The global or static function for the threadMain()

const std::string& G3D::GThread::name (  )  [inline]

Returns thread name.

void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers (  )  [inline, inherited]

Automatically called immediately before the object is deleted.

This is not called from the destructor because it needs to be invoked before the subclass destructor.

bool G3D::GThread::running (  ) 

Returns true if threadMain is currently executing.

bool G3D::GThread::start (  ) 

Starts the thread and executes threadMain().

Returns false if the thread failed to start (either because it was already started or because the OS refused).

void G3D::GThread::terminate (  ) 

Terminates the thread without notifying or waiting for a cancelation point.

virtual void G3D::GThread::threadMain (  )  [pure virtual]

Overriden by the thread implementor.

void G3D::GThread::waitForCompletion (  ) 

Waits for the thread to finish executing.


Friends And Related Function Documentation

friend class _internal::GThreadPrivate [friend]


Member Data Documentation

The long name is to keep this from accidentally conflicting with a subclass's variable name.

Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.

Linked list of all weak pointers that reference this (some may be on the stack!).

Do not use or explicitly manipulate this value.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:46 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo