- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::Threading::CThread Class Reference

Inheritance diagram for Exponent::Threading::CThread:

List of all members.

## Detailed Description

Implementation of a wrapper around a cross platform thread.

Date:
  13/01/2006

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CThread.hpp,v 1.3 2007/02/08 21:06:44 paul Exp

Definition at line 32 of file CThread.hpp.

## Public Member Functions

- CThread ()
- virtual IThread::SThreadHandle * getThreadHandle ()
- virtual IThreadListener * getThreadListener ()
- virtual IThread::EThreadPriority getThreadPriority () const
- virtual bool isThreadActive () const
- virtual void registerThreadListener (IThreadListener *listener)
- virtual bool runThread ()
- virtual void setCriticalSection (CCriticalSection *criticalSection)
- virtual void setThreadHandle (IThread::SThreadHandle *threadHandle)
- virtual void setThreadPriority (const IThread::EThreadPriority priority)
- void sleepThread (const long timeInMilliseconds)
- virtual void stopThread ()
- virtual ~CThread ()

## Protected Member Functions

- void endThread ()

## Protected Attributes

- CCriticalSectionScope m_criticalSectionScope
- EThreadPriority m_priority
- CCriticalSection * m_threadCriticalSection
- IThread::SThreadHandle * m_threadHandle
- bool m_threadIsActive
- IThreadListener * m_threadListener

## Constructor & Destructor Documentation

Exponent::Threading::CThread::CThread | ( |  | ) |

Construction

virtual Exponent::Threading::CThread::~CThread | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

void Exponent::Threading::CThread::endThread | ( |  | ) | `[protected]`

End the thread

Note:
  Makes sure the thread activity status is set correctly, you must call this function
  at the end of your process call

virtual IThread::SThreadHandle* Exponent::Threading::CThread::getThreadHandle | ( |  | ) | `[virtual]`

Get the thread handle

Return values:

  | IThread::SThreadHandle | * Handle to the thread

Implements Exponent::Threading::IThread.

virtual IThreadListener* Exponent::Threading::CThread::getThreadListener | ( |  | ) | `[virtual]`

Get the thread listener

Return values:

  | IThreadListener* | The thread listener

Implements Exponent::Threading::IThread.

virtual IThread::EThreadPriority Exponent::Threading::CThread::getThreadPriority | ( |  | ) | const`[virtual]`

Get the thread priority

Returns:
  EThreadPriority The thread priority

Implements Exponent::Threading::IThread.

virtual bool Exponent::Threading::CThread::isThreadActive | ( |  | ) | const`[virtual]`

Is thread active

Return values:

  | bool | True if thread is running, false otherwise

Implements Exponent::Threading::IThread.

virtual void Exponent::Threading::CThread::registerThreadListener | ( | IThreadListener * | listener | ) | `[virtual]`

Register the thread listener

Parameters:

  | listener | The thread listener

Implements Exponent::Threading::IThread.

virtual bool Exponent::Threading::CThread::runThread | ( |  | ) | `[virtual]`

Do the actual process

Note:
  In subclasses, override this method, but *always* call this
  base class member first. At the end of your process call, make sure
  you call CThread::endThread(). If this is your direct base class, the
  return type is always true and can be ignored

Return values:

  | bool | True if you completed properly, false otherwise

Implements Exponent::Threading::IThread.

virtual void Exponent::Threading::CThread::setCriticalSection | ( | CCriticalSection * | criticalSection | ) | `[virtual]`

Set the critical section

Parameters:

  | criticalSection | The ciritical setion

Implements Exponent::Threading::IThread.

virtual void Exponent::Threading::CThread::setThreadHandle | ( | IThread::SThreadHandle * | threadHandle | ) | `[virtual]`

Set the Thread handle

Parameters:

  | threadHandle | The handle to the thread

Implements Exponent::Threading::IThread.

virtual void Exponent::Threading::CThread::setThreadPriority | ( | const IThread::EThreadPriority | priority | ) | `[virtual]`

Set the thread priority

Parameters:

  | priority | The thread priority

Implements Exponent::Threading::IThread.

void Exponent::Threading::CThread::sleepThread | ( | const long | timeInMilliseconds | ) | `[virtual]`

Sleep the thread

Parameters:

  | timeInMilliseconds | The sleep time in msec

Implements Exponent::Threading::IThread.

virtual void Exponent::Threading::CThread::stopThread | ( |  | ) | `[virtual]`

Stop the thread

Note:
  This is a forced termination, upon reciept of this message you must terminate as quickly as possible

Implements Exponent::Threading::IThread.

## Member Data Documentation

CCriticalSectionScope Exponent::Threading::CThread::m_criticalSectionScope`[protected]`

The critical section scope

Definition at line 154 of file CThread.hpp.

EThreadPriority Exponent::Threading::CThread::m_priority`[protected]`

Priority of the this thread

Definition at line 149 of file CThread.hpp.

CCriticalSection* Exponent::Threading::CThread::m_threadCriticalSection`[protected]`

Threads own critical section

Definition at line 153 of file CThread.hpp.

IThread::SThreadHandle* Exponent::Threading::CThread::m_threadHandle`[protected]`

handle to the platform specific thread handle

Definition at line 152 of file CThread.hpp.

bool Exponent::Threading::CThread::m_threadIsActive`[protected]`

Is the tread active

Definition at line 151 of file CThread.hpp.

IThreadListener* Exponent::Threading::CThread::m_threadListener`[protected]`

Listener for thread events

Definition at line 150 of file CThread.hpp.