Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
Group 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.
Group 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>
Group withCancel (SenderSignalPairGetter &&getter, std::initializer_list< GroupItem > postCancelRecipe={}) const
template<typename SenderSignalPairGetter>
Group withAccept (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 GroupItems &children)
 Constructs a GroupItem element with a given list of items.
 GroupItem (std::initializer_list< GroupItem > children)

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 (const Loop &loop)
 GroupItem ()=default
 GroupItem (Type type)
 GroupItem (const GroupData &data)
 GroupItem (const TaskHandler &handler)
void addChildren (const GroupItems &children)
Static Protected Member Functions inherited from Tasking::GroupItem
static GroupItem groupHandler (const GroupHandler &handler)
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 510 of file tasktree.h.

Constructor & Destructor Documentation

◆ Sync()

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 514 of file tasktree.h.


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