Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cThreadId Class Reference

#include <cThreadLock.h>

Inheritance diagram for Gray::cThreadId:
GrayLib::cThreadBase GrayLib::cThread GrayLib::cThreadChecked GrayLib::cThreadNamed< cUnitTestHttpClient > GrayLib::cThreadNamed< cNetServerThread > GrayLib::cThreadNamed< cJobThreadSeq > GrayLib::cThreadNamed< cUnitTestSecureClient > GrayLib::cThreadNamed< cJobThread > GrayLib::cThreadNamed< cUnitTestOSPipe > GrayLib::cThreadNamed< cUnitTestXProtocolClient > GrayLib::cThreadNamed< cCmdCPULoadThread > GrayLib::cThreadNamed< cUnitTestSSL > GrayLib::cThreadNamed< cLogThread > GrayLib::cThreadNamed< cUnitTestThread > GrayLib::cThreadNamed< cThreadFiber > GrayLib::cThreadNamed< _TYPE >

Public Member Functions

 cThreadId (THREADID_t nThreadId=k_NULL) noexcept
 
THREADID_t GetThreadId () const noexcept
 
THREADID_t get_HashCode () const noexcept
 
bool isCurrentThread () const noexcept
 
bool isValidId () const noexcept
 
void InitCurrentId () noexcept
 

Static Public Member Functions

static THREADID_t GetCurrentId () noexcept
 
static bool IsValidId (THREADID_t id) noexcept
 
static bool IsEqualId (THREADID_t a, THREADID_t b) noexcept
 
static void SleepCurrent (TIMESYS_t uMs=cTimeSys::k_FREQ) noexcept
 

Static Public Attributes

static const THREADID_t k_NULL = 0
 Not a valid thread Id. More...
 

Protected Attributes

THREADID_t m_dwThreadId
 unique thread id. i.e. stack base pointer. (Use the MFC name) More...
 

Friends

class cThreadLockTests
 

Detailed Description

base static namespace for common thread functions. ASSUME all code wants defined(_MT) ?

Constructor & Destructor Documentation

◆ cThreadId()

Gray::cThreadId::cThreadId ( THREADID_t  nThreadId = k_NULL)
inlinenoexcept

Member Function Documentation

◆ get_HashCode()

THREADID_t Gray::cThreadId::get_HashCode ( ) const
inlinenoexcept

Get a unique hash code for the thread.

◆ GetCurrentId()

static THREADID_t Gray::cThreadId::GetCurrentId ( )
inlinestaticnoexcept

Get the callers ThreadId.

Note
We ASSUME this is VERY fast. ASSUME IsValidThreadId();

◆ GetThreadId()

THREADID_t Gray::cThreadId::GetThreadId ( ) const
inlinenoexcept

Similar to the MFC CWorkerThread call. linux use pthread. don't use the old fashioned gettid(). Also (m_hThread == THREADID_t)

◆ InitCurrentId()

void Gray::cThreadId::InitCurrentId ( )
inlinenoexcept

set equal to the current thread id.

◆ isCurrentThread()

bool Gray::cThreadId::isCurrentThread ( ) const
inlinenoexcept

< Is this the current running thread?

◆ IsEqualId()

static bool Gray::cThreadId::IsEqualId ( THREADID_t  a,
THREADID_t  b 
)
inlinestaticnoexcept

Are these id's the same thread? In Linux this might be similar to _WIN32 HANDLE.

◆ isValidId()

bool Gray::cThreadId::isValidId ( ) const
inlinenoexcept

◆ IsValidId()

static bool Gray::cThreadId::IsValidId ( THREADID_t  id)
inlinestaticnoexcept

Is this thread valid? the system thread is considered valid.

◆ SleepCurrent()

static void Gray::cThreadId::SleepCurrent ( TIMESYS_t  uMs = cTimeSys::k_FREQ)
inlinestaticnoexcept

Sleep current thread for n Milliseconds. cTimeSys::k_FREQ Let the OS schedule something else during this time.

Friends And Related Function Documentation

◆ cThreadLockTests

friend class cThreadLockTests
friend

Member Data Documentation

◆ k_NULL

const THREADID_t Gray::cThreadId::k_NULL = 0
static

Not a valid thread Id.

◆ m_dwThreadId

THREADID_t Gray::cThreadId::m_dwThreadId
protected

unique thread id. i.e. stack base pointer. (Use the MFC name)


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