ExecutableItem Class
class Tasking::ExecutableItemBase class for executable task items. More...
Header: | #include <solutions/tasking/tasktree.h> |
Inherits: | Tasking::GroupItem |
Inherited By: |
Note: All functions in this class are reentrant.
Public Functions
Tasking::ExecutableItem | withLog(const QString &logName) const |
Tasking::ExecutableItem | withTimeout(std::chrono::milliseconds timeout, const std::function<void ()> &handler = {}) const |
Detailed Description
ExecutableItem
provides an additional interface for items containing executable tasks. Use withTimeout() to attach a timeout to a task. Use withLog() to include debugging information about the task startup and the execution result.
Member Function Documentation
Tasking::ExecutableItem 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.
The debug printout includes a timestamp of the event (start or finish) and logName to identify the specific task in the debug log.
The finish printout contains the additional information whether the execution was synchronous or asynchronous, its result (the value described by the DoneWith enum), and the total execution time in milliseconds.
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.
When the ExecutableItem finishes before timeout passes, the returned item finishes immediately with the task's result. Otherwise, handler is invoked (if provided), the task is canceled, and the returned item finishes with an error.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.