diff options
Diffstat (limited to 'src/concurrent/qtconcurrentrun.h')
-rw-r--r-- | src/concurrent/qtconcurrentrun.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/concurrent/qtconcurrentrun.h b/src/concurrent/qtconcurrentrun.h index fdcebe0bde..cbc750de84 100644 --- a/src/concurrent/qtconcurrentrun.h +++ b/src/concurrent/qtconcurrentrun.h @@ -4,16 +4,20 @@ #ifndef QTCONCURRENT_RUN_H #define QTCONCURRENT_RUN_H +#if 0 +#pragma qt_class(QtConcurrentRun) +#endif + #include <QtConcurrent/qtconcurrentcompilertest.h> -#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC) +#if !defined(QT_NO_CONCURRENT) || defined(Q_QDOC) #include <QtConcurrent/qtconcurrentrunbase.h> #include <QtConcurrent/qtconcurrentstoredfunctioncall.h> QT_BEGIN_NAMESPACE -#ifdef Q_CLANG_QDOC +#ifdef Q_QDOC typedef int Function; @@ -31,8 +35,11 @@ namespace QtConcurrent { namespace QtConcurrent { +#define QTCONCURRENT_RUN_NODISCARD \ + Q_NODISCARD_X("Use QThreadPool::start(Callable&&) if you don't need the returned QFuture") + template <class Function, class ...Args> -[[nodiscard]] +QTCONCURRENT_RUN_NODISCARD auto run(QThreadPool *pool, Function &&f, Args &&...args) { DecayedTuple<Function, Args...> tuple { std::forward<Function>(f), @@ -42,7 +49,7 @@ auto run(QThreadPool *pool, Function &&f, Args &&...args) } template <class Function, class ...Args> -[[nodiscard]] +QTCONCURRENT_RUN_NODISCARD auto run(QThreadPool *pool, std::reference_wrapper<const Function> &&functionWrapper, Args &&...args) { @@ -51,7 +58,7 @@ auto run(QThreadPool *pool, std::reference_wrapper<const Function> &&functionWra } template <class Function, class ...Args> -[[nodiscard]] +QTCONCURRENT_RUN_NODISCARD auto run(Function &&f, Args &&...args) { return run(QThreadPool::globalInstance(), std::forward<Function>(f), @@ -60,7 +67,7 @@ auto run(Function &&f, Args &&...args) // overload with a Promise Type hint, takes thread pool template <class PromiseType, class Function, class ...Args> -[[nodiscard]] +QTCONCURRENT_RUN_NODISCARD auto run(QThreadPool *pool, Function &&f, Args &&...args) { return (new StoredFunctionCallWithPromise<Function, PromiseType, Args...>( @@ -69,16 +76,18 @@ auto run(QThreadPool *pool, Function &&f, Args &&...args) // overload with a Promise Type hint, uses global thread pool template <class PromiseType, class Function, class ...Args> -[[nodiscard]] +QTCONCURRENT_RUN_NODISCARD auto run(Function &&f, Args &&...args) { return run<PromiseType>(QThreadPool::globalInstance(), std::forward<Function>(f), std::forward<Args>(args)...); } +#undef QTCONCURRENT_RUN_NODISCARD + } //namespace QtConcurrent -#endif // Q_CLANG_QDOC +#endif // Q_QDOC QT_END_NAMESPACE |