Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
Tasking::Sync Class Referencefinal

\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More...

#include <tasktree.h>

+ Inheritance diagram for Tasking::Sync:
+ Collaboration diagram for Tasking::Sync:

Public Member Functions

template<typename Handler >
 Sync (Handler &&handler)
 Constructs an element that executes a passed handler synchronously.
 
- Public Member Functions inherited from Tasking::ExecutableItem
ExecutableItem withTimeout (std::chrono::milliseconds timeout, const std::function< void()> &handler={}) const
 Attaches TimeoutTask to a copy of this ExecutableItem, elapsing after timeout in milliseconds, with an optionally provided timeout handler, and returns the coupled item.
 
ExecutableItem withLog (const QString &logName) const
 Attaches a custom debug printout to a copy of this ExecutableItem, issued on task startup and after the task is finished, and returns the coupled item.
 
template<typename SenderSignalPairGetter >
ExecutableItem withCancel (SenderSignalPairGetter &&getter) const
 
- Public Member Functions inherited from Tasking::GroupItem
template<typename StorageStruct >
 GroupItem (const Storage< StorageStruct > &storage)
 Constructs a GroupItem element holding the storage object.
 
 GroupItem (const Loop &loop)
 
 GroupItem (const QList< GroupItem > &children)
 Constructs a GroupItem element with a given list of items.
 
 GroupItem (std::initializer_list< GroupItem > children)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Additional Inherited Members

- Public Types inherited from Tasking::GroupItem
using GroupSetupHandler = std::function<SetupResult()>
 
using GroupDoneHandler = std::function<DoneResult(DoneWith)>
 
- Protected Types inherited from Tasking::GroupItem
enum class  Type {
  List , Group , GroupData , Storage ,
  TaskHandler
}
 
using InterfaceCreateHandler = std::function<TaskInterface *(void)>
 
using InterfaceSetupHandler = std::function<SetupResult(TaskInterface &)>
 
using InterfaceDoneHandler = std::function<DoneResult(const TaskInterface &, DoneWith)>
 
- Protected Member Functions inherited from Tasking::ExecutableItem
 ExecutableItem ()=default
 
 ExecutableItem (const TaskHandler &handler)
 
- Protected Member Functions inherited from Tasking::GroupItem
 GroupItem ()=default
 
 GroupItem (Type type)
 
 GroupItem (const GroupData &data)
 
 GroupItem (const TaskHandler &handler)
 
void addChildren (const QList< GroupItem > &children)
 
- Static Protected Member Functions inherited from Tasking::GroupItem
static GroupItem groupHandler (const GroupHandler &handler)
 
static GroupItem parallelLimit (int limit)
 
static GroupItem workflowPolicy (WorkflowPolicy policy)
 
template<typename Result , typename Function , typename ... Args, typename DecayedFunction = std::decay_t<Function>>
static constexpr bool isInvocable ()
 

Detailed Description

\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution

Synchronously executes a custom handler between other tasks. \reentrant

Sync is useful when you want to execute an additional handler between other tasks. Sync is seen by its parent \l {Tasking::Group} {Group} as any other task. Avoid long-running execution of the Sync's handler body, since it is executed synchronously from the caller thread. If that is unavoidable, consider using ConcurrentCallTask instead.

Definition at line 423 of file tasktree.h.

Constructor & Destructor Documentation

◆ Sync()

template<typename Handler >
template< typename Handler > Tasking::Sync::Sync ( Handler && handler)
inline

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 \l {workflowPolicy} {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 ConcurrentCallTask.

Note
The Sync element is not counted as a task when reporting task tree progress, and is not included in TaskTree::taskCount() or TaskTree::progressMaximum().

Definition at line 427 of file tasktree.h.

References Tasking::onGroupSetup().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: