![]() |
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>.
|
\inmodule TaskingSolution More...
Classes | |
class | Barrier |
class | BarrierTaskAdapter |
class | ConcurrentCall |
class | ConcurrentCallTaskAdapter |
class | ContainerNode |
class | CustomTask |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | ExecutableItem |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | ExecutionContextActivator |
class | Forever |
class | Group |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | GroupItem |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | Guard |
class | GuardLocker |
class | Loop |
class | LoopData |
class | LoopForever |
class | LoopList |
class | LoopRepeat |
class | LoopThreadData |
class | LoopUntil |
class | NetworkQuery |
class | NetworkQueryTaskAdapter |
class | RuntimeContainer |
class | RuntimeIteration |
class | RuntimeTask |
class | SharedBarrier |
class | Storage |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | StorageBase |
class | StorageData |
class | StorageThreadData |
class | Sync |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskAdapter |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskInterface |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskNode |
class | TaskTree |
\inheaderfile solutions/tasking/tasktree.h \inmodule TaskingSolution More... | |
class | TaskTreePrivate |
class | TaskTreeRunner |
class | TaskTreeTaskAdapter |
class | TimeoutTaskAdapter |
struct | TimerData |
struct | TimerThreadData |
Typedefs | |
using | BarrierTask = CustomTask<BarrierTaskAdapter> |
template<int Limit = 1> | |
using | MultiBarrier = Storage<SharedBarrier<Limit>> |
using | SingleBarrier = MultiBarrier<1> |
template<typename T > | |
using | ConcurrentCallTask = CustomTask<ConcurrentCallTaskAdapter<T>> |
using | NetworkQueryTask = CustomTask<NetworkQueryTaskAdapter> |
using | StoragePtr = void * |
using | TimeoutCallback = std::function<void()> |
using | TaskTreeTask = CustomTask<TaskTreeTaskAdapter> |
using | TimeoutTask = CustomTask<TimeoutTaskAdapter> |
Enumerations | |
enum class | NetworkOperation { Get , Put , Post , Delete } |
enum class | WorkflowPolicy { StopOnError , ContinueOnError , StopOnSuccess , ContinueOnSuccess , StopOnSuccessOrError , FinishAllAndSuccess , FinishAllAndError } |
enum class | SetupResult { Continue , StopWithSuccess , StopWithError } |
enum class | DoneResult { Success , Error } |
enum class | DoneWith { Success , Error , Cancel } |
enum class | CallDoneIf { SuccessOrError , Success , Error } |
Functions | |
template<int Limit> | |
GroupItem | waitForBarrierTask (const MultiBarrier< Limit > &sharedBarrier) |
GroupItem | parallelLimit (int limit) |
Constructs a group's element describing the \l{Execution Mode}{execution mode}. | |
GroupItem | workflowPolicy (WorkflowPolicy policy) |
Constructs a group's \l {Workflow Policy} {workflow policy} element for a given policy. | |
static TaskTree * | activeTaskTree () |
DoneResult | toDoneResult (bool success) |
static SetupResult | toSetupResult (bool success) |
static DoneResult | toDoneResult (DoneWith doneWith) |
static DoneWith | toDoneWith (DoneResult result) |
static QString | currentTime () |
static QString | logHeader (const QString &logName) |
static bool | initialSuccessBit (WorkflowPolicy workflowPolicy) |
static bool | isProgressive (RuntimeContainer *container) |
static std::vector< TaskNode > | createChildren (TaskTreePrivate *taskTreePrivate, const QList< GroupItem > &children) |
static bool | shouldCall (CallDoneIf callDoneIf, DoneWith result) |
static void | removeTimerId (int timerId) |
static void | handleTimeout (int timerId) |
static int | scheduleTimeout (milliseconds timeout, QObject *context, const TimeoutCallback &callback) |
template<typename Handler > | |
static GroupItem | onGroupSetup (Handler &&handler) |
\typealias GroupItem::GroupSetupHandler | |
template<typename Handler > | |
static GroupItem | onGroupDone (Handler &&handler, CallDoneIf callDoneIf=CallDoneIf::SuccessOrError) |
Constructs a group's element holding the group done handler. | |
\inmodule TaskingSolution
The Tasking namespace encloses all classes and global functions of the Tasking solution.
using Tasking::ConcurrentCallTask = CustomTask<ConcurrentCallTaskAdapter<T>> |
Definition at line 113 of file concurrentcall.h.
using Tasking::MultiBarrier = Storage<SharedBarrier<Limit>> |
Definition at line 71 of file networkquery.h.
using Tasking::SingleBarrier = MultiBarrier<1> |
using Tasking::StoragePtr = void * |
Definition at line 1293 of file tasktree.cpp.
Definition at line 635 of file tasktree.h.
using Tasking::TimeoutCallback = std::function<void()> |
Definition at line 3295 of file tasktree.cpp.
Definition at line 636 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
SuccessOrError | |
Success | |
Error |
Definition at line 81 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
Success | |
Error |
Definition at line 66 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
Success | |
Error | |
Cancel |
Definition at line 73 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
Get | |
Put | |
Post | |
Delete |
Definition at line 37 of file networkquery.h.
|
strong |
Enumerator | |
---|---|
Continue | |
StopWithSuccess | |
StopWithError |
Definition at line 58 of file tasktree.h.
|
strong |
Enumerator | |
---|---|
StopOnError | |
ContinueOnError | |
StopOnSuccess | |
ContinueOnSuccess | |
StopOnSuccessOrError | |
FinishAllAndSuccess | |
FinishAllAndError |
Definition at line 46 of file tasktree.h.
|
static |
Definition at line 1199 of file tasktree.cpp.
References QT_ASSERT, and s_activeTaskTrees.
Referenced by Tasking::StorageThreadData::activeStorage(), Tasking::StorageThreadData::pushStorage(), and Tasking::ExecutableItem::withLog().
|
static |
Definition at line 1896 of file tasktree.cpp.
References child.
|
static |
Definition at line 1458 of file tasktree.cpp.
References QTime::currentTime(), and Qt::ISODateWithMs.
Referenced by logHeader().
|
static |
Definition at line 3333 of file tasktree.cpp.
References deadline, it, QT_CHECK, and s_threadTimerData.
Referenced by scheduleTimeout().
|
static |
Definition at line 1673 of file tasktree.cpp.
References ContinueOnError, ContinueOnSuccess, FinishAllAndError, FinishAllAndSuccess, QT_CHECK, StopOnError, StopOnSuccess, StopOnSuccessOrError, and workflowPolicy().
|
static |
Definition at line 1775 of file tasktree.cpp.
References Tasking::RuntimeIteration::m_isProgressive, Tasking::RuntimeTask::m_parentIteration, and Tasking::RuntimeContainer::m_parentTask.
Referenced by Tasking::TaskTreePrivate::start().
Definition at line 1460 of file tasktree.cpp.
References currentTime(), and QString::fromLatin1().
Referenced by Tasking::ExecutableItem::withLog().
|
static |
Constructs a group's element holding the group done handler.
By default, the handler is invoked whenever the group finishes. Pass a non-default value for the callDoneIf argument when you want the handler to be called only on a successful or failed execution. Depending on the group's workflow policy, this handler may also be called when the running group is canceled (e.g. when stopOnError element was used).
The passed handler is of the std::function<DoneResult(DoneWith)>
type. Optionally, each of the return DoneResult type or the argument DoneWith type may be omitted (that is, its return type may be void
). For more information on a possible handler type, refer to \l {GroupItem::GroupDoneHandler}.
When the handler is invoked, all of the group's child tasks are already finished.
If a group contains the Storage elements, the handler is invoked before the storages are destructed, so that the handler may still perform a last read of the active storages' data.
Definition at line 393 of file tasktree.h.
References onGroupDone().
Referenced by onGroupDone(), Assets::Downloader::AssetDownloader::start(), and Tasking::ExecutableItem::withLog().
|
static |
\typealias GroupItem::GroupSetupHandler
Type alias for std::function<SetupResult()>
.
The GroupSetupHandler
is an argument of the onGroupSetup() element. Any function with the above signature, when passed as a group setup handler, will be called by the running task tree when the group execution starts.
The return value of the handler instructs the running group on how to proceed after the handler's invocation is finished. The default return value of SetupResult::Continue instructs the group to continue running, that is, to start executing its child tasks. The return value of SetupResult::StopWithSuccess or SetupResult::StopWithError instructs the group to skip the child tasks' execution and finish immediately with success or an error, respectively.
When the return type is either SetupResult::StopWithSuccess or SetupResult::StopWithError, the group's done handler (if provided) is called synchronously immediately afterwards.
The onGroupSetup() element accepts also functions in the shortened form of std::function<void()>
, that is, the return value is void
. In this case, it's assumed that the return value is SetupResult::Continue.
\typealias GroupItem::GroupDoneHandler
Type alias for std::function<DoneResult(DoneWith)>
.
The GroupDoneHandler
is an argument of the onGroupDone() element. Any function with the above signature, when passed as a group done handler, will be called by the running task tree when the group execution ends.
The DoneWith argument is optional and your done handler may omit it. When provided, it holds the info about the final result of a group that will be reported to its parent.
The returned DoneResult value is optional and your handler may return void
instead. In this case, the final result of the group will be equal to the value indicated by the DoneWith argument. When the handler returns the DoneResult value, the group's final result may be tweaked inside the done handler's body by the returned value.
Constructs a group's element holding the group setup handler. The handler is invoked whenever the group starts.
The passed handler is either of the std::function<SetupResult()>
or the std::function<void()>
type. For more information on a possible handler type, refer to \l {GroupItem::GroupSetupHandler}.
When the handler is invoked, none of the group's child tasks are running yet.
If a group contains the Storage elements, the handler is invoked after the storages are constructed, so that the handler may already perform some initial modifications to the active storages.
Definition at line 387 of file tasktree.h.
References onGroupSetup().
Referenced by Tasking::Sync::Sync(), onGroupSetup(), Assets::Downloader::AssetDownloader::start(), and Tasking::ExecutableItem::withLog().
TASKING_EXPORT GroupItem Tasking::parallelLimit | ( | int | limit | ) |
Constructs a group's element describing the \l{Execution Mode}{execution mode}.
The execution mode element in a Group specifies how the direct child tasks of the Group are started.
For convenience, when appropriate, the \l sequential or \l parallel global elements may be used instead.
The limit defines the maximum number of direct child tasks running in parallel:
\list
In all execution modes, a group starts tasks in the oder in which they appear.
If a child of a group is also a group, the child group runs its tasks according to its own execution mode.
Definition at line 1162 of file tasktree.cpp.
References Tasking::Group::parallelLimit(), and qMax().
|
static |
Definition at line 3317 of file tasktree.cpp.
References deadline, it, QT_ASSERT, qWarning, and s_threadTimerData.
Referenced by Tasking::TimeoutTaskAdapter::~TimeoutTaskAdapter().
|
static |
Definition at line 3372 of file tasktree.cpp.
References deadline, handleTimeout(), s_threadTimerData, and QTimer::singleShot.
Referenced by Tasking::TimeoutTaskAdapter::start().
|
static |
Definition at line 2106 of file tasktree.cpp.
References Error, and Success.
Referenced by Tasking::TaskTreePrivate::invokeDoneHandler(), and Tasking::TaskTreePrivate::invokeDoneHandler().
TASKING_EXPORT DoneResult Tasking::toDoneResult | ( | bool | success | ) |
Definition at line 1205 of file tasktree.cpp.
References Error, and Success.
Referenced by Tasking::TaskTreeTaskAdapter::TaskTreeTaskAdapter(), Tasking::TaskTreePrivate::invokeDoneHandler(), and Tasking::TaskTreePrivate::invokeDoneHandler().
|
static |
Definition at line 1215 of file tasktree.cpp.
|
static |
Definition at line 1220 of file tasktree.cpp.
|
static |
Definition at line 1210 of file tasktree.cpp.
References StopWithError, and StopWithSuccess.
Referenced by Tasking::TaskTreePrivate::childDone(), Tasking::TaskTreePrivate::start(), and Tasking::TaskTreePrivate::startChildren().
GroupItem Tasking::waitForBarrierTask | ( | const MultiBarrier< Limit > & | sharedBarrier | ) |
Definition at line 85 of file barrier.h.
References QObject::connect(), Continue, Tasking::Barrier::done(), qWarning, Tasking::Barrier::result(), StopWithError, Tasking::Barrier::stopWithResult(), StopWithSuccess, and Success.
TASKING_EXPORT GroupItem Tasking::workflowPolicy | ( | WorkflowPolicy | policy | ) |
Constructs a group's \l {Workflow Policy} {workflow policy} element for a given policy.
For convenience, global elements may be used instead.
Definition at line 1175 of file tasktree.cpp.
References policy, and Tasking::Group::workflowPolicy().
Referenced by Tasking::TaskTreePrivate::childDone(), and initialSuccessBit().
TASKING_EXPORT const GroupItem Tasking::continueOnError = workflowPolicy(WorkflowPolicy::ContinueOnError) |
Definition at line 1187 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::continueOnSuccess = workflowPolicy(WorkflowPolicy::ContinueOnSuccess) |
Definition at line 1189 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::finishAllAndError = workflowPolicy(WorkflowPolicy::FinishAllAndError) |
Definition at line 1192 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::withTimeout().
TASKING_EXPORT const GroupItem Tasking::finishAllAndSuccess = workflowPolicy(WorkflowPolicy::FinishAllAndSuccess) |
Definition at line 1191 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::nullItem = GroupItem({}) |
Definition at line 1180 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::parallel = parallelLimit(0) |
Definition at line 1183 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::withTimeout().
TASKING_EXPORT const GroupItem Tasking::parallelIdealThreadCountLimit = parallelLimit(qMax(QThread::idealThreadCount() - 1, 1)) |
Definition at line 1184 of file tasktree.cpp.
Referenced by Assets::Downloader::AssetDownloader::start().
|
constexpr |
Definition at line 1295 of file tasktree.cpp.
Referenced by Tasking::StorageThreadData::activeStorage().
Definition at line 1197 of file tasktree.cpp.
Referenced by Tasking::ExecutionContextActivator::~ExecutionContextActivator(), and activeTaskTree().
|
static |
Definition at line 3315 of file tasktree.cpp.
Referenced by handleTimeout(), removeTimerId(), and scheduleTimeout().
TASKING_EXPORT const GroupItem Tasking::sequential = parallelLimit(1) |
Definition at line 1182 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::stopOnError = workflowPolicy(WorkflowPolicy::StopOnError) |
Definition at line 1186 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::stopOnSuccess = workflowPolicy(WorkflowPolicy::StopOnSuccess) |
Definition at line 1188 of file tasktree.cpp.
TASKING_EXPORT const GroupItem Tasking::stopOnSuccessOrError = workflowPolicy(WorkflowPolicy::StopOnSuccessOrError) |
Definition at line 1190 of file tasktree.cpp.
Referenced by Tasking::ExecutableItem::withTimeout().