DelegateMQ
Loading...
Searching...
No Matches
Thread Class Reference

#include <Thread.h>

Inheritance diagram for Thread:
dmq::IThread dmq::IThread

Public Member Functions

 Thread (const std::string &threadName)
 Constructor.
 
 ~Thread ()
 Destructor.
 
bool CreateThread ()
 
TaskHandle_t GetThreadId ()
 Get the ID of this thread instance.
 
std::string GetThreadName ()
 Get thread name.
 
virtual void DispatchDelegate (std::shared_ptr< dmq::DelegateMsg > msg)
 
 Thread (const std::string &threadName)
 Constructor.
 
 ~Thread ()
 Destructor.
 
bool CreateThread ()
 
void ExitThread ()
 Called once a program exit to exit the worker thread.
 
std::thread::id GetThreadId ()
 Get the ID of this thread instance.
 
std::string GetThreadName ()
 Get thread name.
 
size_t GetQueueSize ()
 Get size of thread message queue.
 
virtual void DispatchDelegate (std::shared_ptr< dmq::DelegateMsg > msg)
 
- Public Member Functions inherited from dmq::IThread
virtual ~IThread ()=default
 Destructor.
 

Static Public Member Functions

static TaskHandle_t GetCurrentThreadId ()
 Get the ID of the currently executing thread.
 
static std::thread::id GetCurrentThreadId ()
 Get the ID of the currently executing thread.
 

Constructor & Destructor Documentation

◆ Thread() [1/2]

Thread::Thread ( const std::string & threadName)

Constructor.

◆ ~Thread() [1/2]

Thread::~Thread ( )

Destructor.

◆ Thread() [2/2]

Thread::Thread ( const std::string & threadName)

Constructor.

◆ ~Thread() [2/2]

Thread::~Thread ( )

Destructor.

Member Function Documentation

◆ CreateThread() [1/2]

bool Thread::CreateThread ( )

Called once to create the worker thread

Returns
TRUE if thread is created. FALSE otherise.

◆ CreateThread() [2/2]

bool Thread::CreateThread ( )

Called once to create the worker thread

Returns
TRUE if thread is created. FALSE otherise.

◆ DispatchDelegate() [1/2]

virtual void Thread::DispatchDelegate ( std::shared_ptr< dmq::DelegateMsg > msg)
virtual

Dispatch a DelegateMsg onto this thread. The implementer is responsible for getting the DelegateMsg into an OS message queue. Once DelegateMsg is on the destination thread of control, the IDelegateInvoker::Invoke() function must be called to execute the target function.

Parameters
[in]msgA shared pointer to the message.
Postcondition
The destination thread calls IThreadInvoker::Invoke() when DelegateMsg is received.

Implements dmq::IThread.

◆ DispatchDelegate() [2/2]

void Thread::DispatchDelegate ( std::shared_ptr< dmq::DelegateMsg > msg)
virtual

Dispatch a DelegateMsg onto this thread. The implementer is responsible for getting the DelegateMsg into an OS message queue. Once DelegateMsg is on the destination thread of control, the IDelegateInvoker::Invoke() function must be called to execute the target function.

Parameters
[in]msgA shared pointer to the message.
Postcondition
The destination thread calls IThreadInvoker::Invoke() when DelegateMsg is received.

Implements dmq::IThread.

◆ ExitThread()

void Thread::ExitThread ( )

Called once a program exit to exit the worker thread.

◆ GetCurrentThreadId() [1/2]

std::thread::id Thread::GetCurrentThreadId ( )
static

Get the ID of the currently executing thread.

◆ GetCurrentThreadId() [2/2]

static std::thread::id Thread::GetCurrentThreadId ( )
static

Get the ID of the currently executing thread.

◆ GetQueueSize()

size_t Thread::GetQueueSize ( )

Get size of thread message queue.

◆ GetThreadId() [1/2]

std::thread::id Thread::GetThreadId ( )

Get the ID of this thread instance.

◆ GetThreadId() [2/2]

std::thread::id Thread::GetThreadId ( )

Get the ID of this thread instance.

◆ GetThreadName() [1/2]

std::string Thread::GetThreadName ( )
inline

Get thread name.

◆ GetThreadName() [2/2]

std::string Thread::GetThreadName ( )
inline

Get thread name.


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