3 #include "TaskThread.h" 21 template <
class ResultType>
35 , m_func(std::move(func))
42 std::optional<ResultType>
result()
const 44 std::lock_guard<std::mutex> lck (m_resultMutex);
55 auto result = m_func(
this);
56 std::lock_guard<std::mutex> lck (m_resultMutex);
57 m_result = std::move(
result);
64 std::optional<ResultType> m_result;
65 mutable std::mutex m_resultMutex;
87 , m_func(std::move(func))
std::optional< ResultType > result() const
Definition: FunctionThread.h:42
std::function< void(TaskThread *)> Function
Definition of a function to be passed to constructor of this class.
Definition: FunctionThread.h:78
void run() override
Definition: FunctionThread.h:94
FunctionThread(Function func, QObject *parent=nullptr)
Definition: FunctionThread.h:33
FunctionThread(Function func, QObject *parent=nullptr)
Definition: FunctionThread.h:85
Base class for all threads capable of reporting progress and cancelling the progress when requested.
Definition: TaskThread.h:11
void run() override
Definition: FunctionThread.h:53
std::function< ResultType(TaskThread *)> Function
Definition of a function to be passed to constructor of this class.
Definition: FunctionThread.h:26
A thread class, which executes the function provided in the constructor of this class as soon as the ...
Definition: FunctionThread.h:22
A thread class, which executes the function provided in the constructor of this class as soon as the ...
Definition: FunctionThread.h:73