AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
AAbstractThread Class Reference

Represents an abstract thread. Not all threads are created through AThread - these are interfaced with AAbstractThread. More...

Detailed Description

Represents an abstract thread. Not all threads are created through AThread - these are interfaced with AAbstractThread.

Examples
/github/workspace/aui.core/src/AUI/Common/AObject.h.

Public Types

typedef std::thread::id id
 Thread ID type.
 

Public Member Functions

id getId () const
 
void enqueue (AMessageQueue<>::Message f)
 Delivers task for execution (message) to this thread's event queue. Messages are processed by framework itself using AEventLoop. This behaviour may be overwritten using the AThread::processMessages() function.
 
virtual bool isInterrupted ()
 
virtual void resetInterruptFlag ()
 Reset interruption flag. More...
 
virtual void interrupt ()
 Interrupt thread's execution. More...
 
IEventLoopgetCurrentEventLoop () const
 Get current event loop for this thread. More...
 
template<class Callable >
void operator<< (Callable fun)
 Enqueue message to make. More...
 
template<class Callable >
void operator* (Callable fun)
 Enqueue message to make. Helper function for async, asyncX, ui, uiX. More...
 
const AStringthreadName () const noexcept
 
AStacktrace threadStacktrace () const
 Retrieve stacktrace of the thread.
 
bool messageQueueEmpty () noexcept
 

Protected Member Functions

 AAbstractThread (const id &id) noexcept
 
void updateThreadName () noexcept
 
virtual void processMessagesImpl ()
 

Protected Attributes

id mId
 Thread ID.
 
AString mThreadName
 
AMessageQueue mMessageQueue
 

Friends

class IEventLoop
 
class AThread
 
class AConditionVariable
 
void setupUIThread () noexcept
 

Member Function Documentation

◆ getCurrentEventLoop()

IEventLoop * AAbstractThread::getCurrentEventLoop ( ) const
inline

Get current event loop for this thread.

Returns
current event loop for this thread

◆ getId()

AAbstractThread::id AAbstractThread::getId ( ) const
Returns
thread ID

◆ interrupt()

void AAbstractThread::interrupt ( )
virtual

Interrupt thread's execution.

Raises the interruption flag of the thread. In order to check whether thread interrupted use AThread::interruptionPoint() or AAbstractThread::isInterrupted().

Reimplemented in AThread.

◆ isInterrupted()

bool AAbstractThread::isInterrupted ( )
virtual
Returns
true if interrupt requested for this thread.

Reimplemented in AThread.

◆ operator*()

template<class Callable >
void AAbstractThread::operator* ( Callable  fun)
inline

Enqueue message to make. Helper function for async, asyncX, ui, uiX.

Template Parameters
Callablecallable
Parameters
funcallable function

◆ operator<<()

template<class Callable >
void AAbstractThread::operator<< ( Callable  fun)
inline

Enqueue message to make.

Template Parameters
Callablecallable
Parameters
funcallable function

◆ resetInterruptFlag()

void AAbstractThread::resetInterruptFlag ( )
virtual

Reset interruption flag.

Reimplemented in AThread.

#include <AUI/Thread/AThread.h>


The documentation for this class was generated from the following files:
Inheritance diagram for AAbstractThread:
Collaboration diagram for AAbstractThread: