AUI Framework  master
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AAbstractThread Class Reference

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

#include <AUI/Thread/AThread.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.
 
const AMessageQueuemessageQueue () const
 
virtual bool isInterrupted ()
 
virtual void resetInterruptFlag ()
 Reset interruption flag.
 
virtual void interrupt ()
 Interrupt thread's execution.
 
IEventLoopgetCurrentEventLoop () const
 Get current event loop for this thread.
 
template<class Callable>
void operator<< (Callable fun)
 Enqueue message to make.
 
template<class Callable>
void operator* (Callable fun)
 Enqueue message to make. Helper function for async, asyncX, ui, uiX.
 
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
 

Member Function Documentation#

◆ getCurrentEventLoop()#

IEventLoop * AAbstractThread::getCurrentEventLoop ( ) const
inline
Returns
current event loop for this thread

◆ getId()#

id AAbstractThread::getId ( ) const
Returns
thread ID

◆ interrupt()#

virtual void AAbstractThread::interrupt ( )
virtual

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

Reimplemented in AThread.

◆ isInterrupted()#

virtual 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
Template Parameters
Callablecallable
Parameters
funcallable function

◆ operator<<()#

template<class Callable>
void AAbstractThread::operator<< ( Callable fun)
inline
Template Parameters
Callablecallable
Parameters
funcallable function

◆ resetInterruptFlag()#

virtual void AAbstractThread::resetInterruptFlag ( )
virtual

Reimplemented in AThread.