|
RADLib
RADical C++ application framework
|
Thread object with an owned RADCore EventLoop. More...
#include <RADCore.h>
Inheritance diagram for RADCore::RADThread:
Collaboration diagram for RADCore::RADThread:Public Member Functions | |
| RADThread () | |
| Creates a stopped thread object. More... | |
| virtual | ~RADThread () |
| Quits and joins the thread when needed. More... | |
| void | start (LoopStrategy strategy=LoopStrategy::RADEVENT_LOCK) |
| Starts the thread and its event loop. More... | |
| void | quit () |
| Requests the event loop to quit. More... | |
| void | wait () |
| Blocks until the thread exits. More... | |
| EventLoop & | eventLoop () |
| Returns the thread's event loop after start(). More... | |
| bool | isRunning () const |
| Returns true while the thread is running. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Public Attributes | |
| RADCore::Event< void() > | started |
| Raised when the thread starts running. More... | |
| RADCore::Event< void() > | finished |
| Raised when the thread exits. More... | |
Protected Member Functions | |
| virtual void | run () |
| Override to run custom work before/around the event loop. More... | |
| RADCore::RADThread::RADThread | ( | ) |
Creates a stopped thread object.
|
virtual |
Quits and joins the thread when needed.
| bool RADCore::RADThread::isRunning | ( | ) | const |
Returns true while the thread is running.
| void RADCore::RADThread::quit | ( | ) |
Requests the event loop to quit.
|
protectedvirtual |
Override to run custom work before/around the event loop.
| void RADCore::RADThread::start | ( | LoopStrategy | strategy = LoopStrategy::RADEVENT_LOCK | ) |
Starts the thread and its event loop.
| void RADCore::RADThread::wait | ( | ) |
Blocks until the thread exits.
| RADCore::Event<void () > RADCore::RADThread::finished |
Raised when the thread exits.
| RADCore::Event<void () > RADCore::RADThread::started |
Raised when the thread starts running.