summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtconcurrentrun.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/concurrent/qtconcurrentrun.h')
-rw-r--r--src/concurrent/qtconcurrentrun.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/concurrent/qtconcurrentrun.h b/src/concurrent/qtconcurrentrun.h
index cf153ab34e..cbc750de84 100644
--- a/src/concurrent/qtconcurrentrun.h
+++ b/src/concurrent/qtconcurrentrun.h
@@ -35,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),
@@ -46,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)
{
@@ -55,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),
@@ -64,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...>(
@@ -73,13 +76,15 @@ 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_QDOC