QSyncTask Class
Synchronously executes a custom handler between other tasks. More...
| Header: | #include <qtasktree.h> |
Note: All functions in this class are reentrant.
Public Functions
| QSyncTask(Handler &&handler) |
Detailed Description
QSyncTask is useful when you want to execute an additional handler between other tasks. QSyncTask is seen by its parent Group as any other task. Avoid long-running execution of the QSyncTask's handler body, since it is executed synchronously from the caller thread. If that is unavoidable, consider using QThreadFunctionTask instead.
Member Function Documentation
template <typename Handler> QSyncTask::QSyncTask(Handler &&handler)
Constructs an element that executes a passed handler synchronously. The Handler is of the std::function<DoneResult()> type. The DoneResult value, returned by the handler, is considered during parent group's workflow policy resolution. Optionally, the shortened form of std::function<void()> is also accepted. In this case, it's assumed that the return value is DoneResult::Success.
The passed handler executes synchronously from the caller thread, so avoid a long-running execution of the handler body. Otherwise, consider using QThreadFunctionTask.
Note: The QSyncTask element is not counted as a task when reporting task tree progress, and is not included in QTaskTree::taskCount() or QTaskTree::progressMaximum().