The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CThread Class Reference
[Win32 Threading primitives]

Inheritance diagram for CThread:
Collaboration diagram for CThread:

List of all members.


Detailed Description

A class that wraps the operating system Threading API and provides a thread object that runs code which implements the IRunnable interface.


Public Member Functions

 CThread (Core::IRunnable &runnable)
 Create a thread to run the supplied instance of IRunnable.
 CThread (const CThread &rhs)
 ~CThread () override
CThreadoperator= (const CThread &rhs)
void Start ()
 Start the thread running.
void Start (bool startSuspended)
 Start the thread running and optionally start it in a suspended state.
void StartSuspended ()
 Start the thread in a suspended state.
void StartWithPriority (int priority)
 Start the thread with the specified thread priority.
void Resume ()
 Resume a suspended thread.
void Terminate (DWORD exitCode=0)
 Terminate a thread and have it return the supplied exit code. Note that this should be used with great care!
bool IsRunning () const
 Returns true if the thread is running.
void SetThreadName (const Core::_tstring &threadName) const
 Sets a threads name so that it can be queried in a debugger.
bool IsThisThread () const
 Returns true if the thread object represents the thread that is calling IsThisThread().
void EnableThreadPriorityBoost ()
void DisableThreadPriorityBoost ()
bool ThreadPriorityBoostEnabled () const
void SetThreadPriority (int priority)
int GetThreadPriority () const
HANDLE GetWaitHandle () const override
void Wait () const override
bool Wait (Milliseconds timeout) const override

Static Public Member Functions

static void SetCurrentThreadName (const Core::_tstring &threadName)
 Sets the current threads name so that it can be queried in a debugger.
static void SetThreadName (DWORD threadID, const Core::_tstring &threadName)
 Sets the supplied threads name so that it can be queried in a debugger.
static void AddThreadNameListener (IListenToThreadNaming &listener)
static void RemoveThreadNameListener (IListenToThreadNaming &listener)
static void AddThreadStartListener (IListenToThreadStart &listener)
static void RemoveThreadStartListener (IListenToThreadStart &listener)
static void AddThreadStopListener (IListenToThreadStop &listener)
static void RemoveThreadStopListener (IListenToThreadStop &listener)

Protected Member Functions

void NotifyThreadStartListeners ()
void NotifyThreadStopListeners ()

Static Protected Member Functions

static void SetThreadName (const _tstring &threadID, const _tstring &threadName)


Constructor & Destructor Documentation

CThread ( Core::IRunnable runnable  )  [explicit]

Create a thread to run the supplied instance of IRunnable.

CThread ( const CThread rhs  ) 

~CThread (  )  [override]


Member Function Documentation

CThread& operator= ( const CThread rhs  ) 

void Start (  ) 

Start the thread running.

void Start ( bool  startSuspended  ) 

Start the thread running and optionally start it in a suspended state.

void StartSuspended (  ) 

Start the thread in a suspended state.

void StartWithPriority ( int  priority  ) 

Start the thread with the specified thread priority.

void Resume (  ) 

Resume a suspended thread.

void Terminate ( DWORD  exitCode = 0  ) 

Terminate a thread and have it return the supplied exit code. Note that this should be used with great care!

bool IsRunning (  )  const

Returns true if the thread is running.

void SetThreadName ( const Core::_tstring threadName  )  const

Sets a threads name so that it can be queried in a debugger.

bool IsThisThread (  )  const

Returns true if the thread object represents the thread that is calling IsThisThread().

static void SetCurrentThreadName ( const Core::_tstring threadName  )  [static]

Sets the current threads name so that it can be queried in a debugger.

static void SetThreadName ( DWORD  threadID,
const Core::_tstring threadName 
) [static]

Sets the supplied threads name so that it can be queried in a debugger.

void EnableThreadPriorityBoost (  ) 

void DisableThreadPriorityBoost (  ) 

bool ThreadPriorityBoostEnabled (  )  const

void SetThreadPriority ( int  priority  ) 

int GetThreadPriority (  )  const

HANDLE GetWaitHandle (  )  const [override]

void Wait (  )  const [override]

bool Wait ( Milliseconds  timeout  )  const [override]

void AddThreadNameListener ( IListenToThreadNaming listener  )  [static, inherited]

void RemoveThreadNameListener ( IListenToThreadNaming listener  )  [static, inherited]

void AddThreadStartListener ( IListenToThreadStart listener  )  [static, inherited]

void RemoveThreadStartListener ( IListenToThreadStart listener  )  [static, inherited]

void AddThreadStopListener ( IListenToThreadStop listener  )  [static, inherited]

void RemoveThreadStopListener ( IListenToThreadStop listener  )  [static, inherited]

void SetThreadName ( const _tstring threadID,
const _tstring threadName 
) [static, protected, inherited]

void NotifyThreadStartListeners (  )  [protected, inherited]

void NotifyThreadStopListeners (  )  [protected, inherited]


Generated on Sun Sep 12 19:11:51 2021 for The Server Framework - v7.4 by doxygen 1.5.3