summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthreadpool.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-05-06 10:53:06 -0700
committerThiago Macieira <thiago.macieira@intel.com>2024-05-09 21:27:34 -0700
commit179e79b18d1827e38d8ffe2914e5d15b12e270d5 (patch)
tree3ffebb4b6fabf95a7c0934a385f02effbc906ace /src/corelib/thread/qthreadpool.h
parent95d4e6bababfeb36fa8a355a8487b64eb3ffb587 (diff)
QThreadPool: add waitForDone() based on QDeadlineTimer
It was already being used internally this way, so all we needed was to provide the front-end API and inline the old API. [ChangeLog][QtCore][QThreadPool] Added an overload of waitForDone() based on QDeadlineTimer. Fixes: QTBUG-125107 Change-Id: Ic5b1273bb0204c31afd8fffd17ccf7c5bee07c35 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'src/corelib/thread/qthreadpool.h')
-rw-r--r--src/corelib/thread/qthreadpool.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h
index 8f0130bd84..0640f41587 100644
--- a/src/corelib/thread/qthreadpool.h
+++ b/src/corelib/thread/qthreadpool.h
@@ -72,7 +72,9 @@ public:
void reserveThread();
void releaseThread();
- bool waitForDone(int msecs = -1);
+ QT_CORE_INLINE_SINCE(6, 8)
+ bool waitForDone(int msecs);
+ bool waitForDone(QDeadlineTimer deadline = QDeadlineTimer::Forever);
void clear();
@@ -103,6 +105,13 @@ void QThreadPool::startOnReservedThread(Callable &&functionToRun)
startOnReservedThread(QRunnable::create(std::forward<Callable>(functionToRun)));
}
+#if QT_CORE_INLINE_IMPL_SINCE(6, 8)
+bool QThreadPool::waitForDone(int msecs)
+{
+ return waitForDone(QDeadlineTimer(msecs));
+}
+#endif
+
QT_END_NAMESPACE
#endif