33 virtual void run() = 0;
90 template<
typename C,
typename... Args>
103 virtual void run()
override {
104 call(std::index_sequence_for<Args...>{});
120 template <std::size_t... I>
121 void call(std::index_sequence<I...>) {
164 template<
typename C,
typename... Args>
165 Thread(
QEventBus& qBus,
void(C::* function)(), C*
object, Args&&... args);
183 friend class ThreadImpl;
216 template<
typename C,
typename ...Args>
Thread-safe event bus.
Definition QEventBus.hpp:58
void launch()
Start execution of the stored callable on a new thread.
Definition Thread.cpp:10
~Thread()
Destructor; cleans up stored callable and implementation pointer.
Definition Thread.cpp:5
Thread(QEventBus &qBus, F function)
Construct a Thread from a generic callable (lambda, functor, function pointer).
Definition Thread.hpp:203
void wait()
Block until the thread has finished executing.
Definition Thread.cpp:17
Platform-specific thread implementation.
Definition ThreadImpl.hpp:32
Abstract type-erased callable interface used as a thread entry point.
Definition Thread.hpp:22
virtual ~ThreadFunc()
Virtual destructor to allow safe deletion via base pointer.
Definition Thread.hpp:26
virtual void run()=0
Execute the wrapped callable.
Adapter that wraps a generic functor/lambda.
Definition Thread.hpp:41
F functor
The stored functor instance.
Definition Thread.hpp:54
ThreadFunctor(F functor)
Construct the adapter with the provided functor.
Definition Thread.hpp:46
virtual void run() override
Invoke the stored functor.
Definition Thread.hpp:51
Adapter that wraps a member function without extra arguments.
Definition Thread.hpp:62
void(C::* functor)()
Pointer to the member function to invoke.
Definition Thread.hpp:79
ThreadMemberFunctor(void(C::*function)(), C *object)
Construct with member function pointer and target object.
Definition Thread.hpp:68
virtual void run() override
Invoke the stored member function on the stored object.
Definition Thread.hpp:76
C * object
Pointer to the object instance used when invoking the member function.
Definition Thread.hpp:82
Adapter that wraps a member function with arbitrary arguments.
Definition Thread.hpp:91
virtual void run() override
Invoke the stored member function forwarding the stored arguments.
Definition Thread.hpp:103
C * object
Pointer to the object instance used when invoking the member function.
Definition Thread.hpp:111
std::tuple< Args... > args
Tuple holding the arguments to forward to the member function.
Definition Thread.hpp:114
ThreadMemberFunctorWithArgs(void(C::*function)(Args...), C *object, Args &&... args)
Construct with member function pointer, target object and arguments.
Definition Thread.hpp:98
void(C::* functor)(Args...)
Pointer to the member function to invoke.
Definition Thread.hpp:108