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

CThread Class Reference

Inheritance diagram for CThread:
Collaboration diagram for CThread:

List of all members.

Public Member Functions

 CThread (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.
bool IsRunning () const
 Returns true if the thread is running.
void SetThreadName (const _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().
HANDLE GetWaitHandle () const override
 Access a HANDLE to wait on by passing it to one of the Wait Functions.
void Wait () const override
 Wait indefinitely for the object to become signalled.
bool Wait (Milliseconds timeout) const override
 Wait, with a time limit, for the object to become signalled. If you want to wait for 0 milliseconds and you get an "ambiguous call" with the Handle version then use IsSignalled() which is the same as Wait(0).
virtual bool IsSignalled () const
 Returns true if the object is signalled and false if it isn't; doesn't block.

Static Public Member Functions

static void SetCurrentThreadName (const _tstring &threadName)
 Sets the current threads name so that it can be queried in a debugger.
static void SetThreadName (ThreadId threadID, const _tstring &threadName)
 Sets the supplied threads name so that it can be queried in a debugger.
static void WaitForHandle (HANDLE handle)
 Wait indefinitely for the supplied handle to become signalled.
static bool WaitForHandle (HANDLE handle, Milliseconds timeout)
 Wait, with a time limit, for the supplied handle to become signalled.
static DWORD WaitForMultipleHandles (DWORD numHandles, HANDLE *pHandles, bool waitAll, Milliseconds timeout)
static bool WaitWithMessageLoop (HANDLE handle, Milliseconds timeout)
static bool WaitWithMessageLoop (HANDLE handle, Milliseconds timeout, DWORD removeFlags)
static bool WaitWithMessageLoop (DWORD numHandles, const HANDLE *pHandles, Milliseconds timeout)
static bool WaitWithMessageLoop (DWORD numHandles, const HANDLE *pHandles, DWORD &signalledHandle, Milliseconds timeout)
static bool WaitWithMessageLoop (DWORD numHandles, const HANDLE *pHandles, DWORD &signalledHandle, Milliseconds timeout, DWORD removeFlags)
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 ( 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.

bool IsRunning (  )  const

Returns true if the thread is running.

void SetThreadName ( const _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 SetCurrentThreadName ( const _tstring threadName  )  [static]

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

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

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

HANDLE GetWaitHandle (  )  const [override, virtual]

Access a HANDLE to wait on by passing it to one of the Wait Functions.

Implements IWaitable.

void Wait (  )  const [override, virtual]

Wait indefinitely for the object to become signalled.

Implements IWaitable.

bool Wait ( Milliseconds  timeout  )  const [override, virtual]

Wait, with a time limit, for the object to become signalled. If you want to wait for 0 milliseconds and you get an "ambiguous call" with the Handle version then use IsSignalled() which is the same as Wait(0).

Implements IWaitable.

bool IsSignalled (  )  const [virtual, inherited]

Returns true if the object is signalled and false if it isn't; doesn't block.

void WaitForHandle ( HANDLE  handle  )  [static, inherited]

Wait indefinitely for the supplied handle to become signalled.

bool WaitForHandle ( HANDLE  handle,
Milliseconds  timeout 
) [static, inherited]

Wait, with a time limit, for the supplied handle to become signalled.

DWORD WaitForMultipleHandles ( DWORD  numHandles,
HANDLE pHandles,
bool  waitAll,
Milliseconds  timeout 
) [static, inherited]

bool WaitWithMessageLoop ( HANDLE  handle,
Milliseconds  timeout 
) [static, inherited]

bool WaitWithMessageLoop ( HANDLE  handle,
Milliseconds  timeout,
DWORD  removeFlags 
) [static, inherited]

bool WaitWithMessageLoop ( DWORD  numHandles,
const HANDLE pHandles,
Milliseconds  timeout 
) [static, inherited]

bool WaitWithMessageLoop ( DWORD  numHandles,
const HANDLE pHandles,
DWORD signalledHandle,
Milliseconds  timeout 
) [static, inherited]

bool WaitWithMessageLoop ( DWORD  numHandles,
const HANDLE pHandles,
DWORD signalledHandle,
Milliseconds  timeout,
DWORD  removeFlags 
) [static, inherited]

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:09:07 2021 for The Server Framework - v7.4 by doxygen 1.5.3