diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2012-04-16 14:39:36 +0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-17 18:44:13 +0200 |
commit | dab2e1fea776062fca8dcca7c81dec82bfe34839 (patch) | |
tree | 12ddc34cb6c3df71cd80e0f8d680c5de77f898ce /src/corelib/thread | |
parent | cbaf52b09971edf6f3e1458f7dd677b80a1568ed (diff) |
QThreadPool: unify waitForDone() overloads
Change-Id: I1515a65fab37588372794422a43ed09ac076e108
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 19 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool.h | 3 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool_p.h | 2 |
3 files changed, 5 insertions, 19 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 870f943a63..7f26dfe326 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -410,8 +410,7 @@ QThreadPool::QThreadPool(QObject *parent) */ QThreadPool::~QThreadPool() { - d_func()->waitForDone(); - d_func()->reset(); + waitForDone(); } /*! @@ -593,22 +592,10 @@ void QThreadPool::releaseThread() } /*! - Waits for each thread to exit and removes all threads from the thread pool. -*/ -void QThreadPool::waitForDone() -{ - Q_D(QThreadPool); - d->waitForDone(); - d->reset(); -} - -/*! - \overload waitForDone() - \since 4.8 - Waits up to \a msecs milliseconds for all threads to exit and removes all threads from the thread pool. Returns true if all threads were removed; - otherwise it returns false. + otherwise it returns false. If \a msecs is -1 (the default), the timeout + is ignored (waits for the last thread to exit). */ bool QThreadPool::waitForDone(int msecs) { diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h index 9fc023c56d..dd931713f7 100644 --- a/src/corelib/thread/qthreadpool.h +++ b/src/corelib/thread/qthreadpool.h @@ -83,8 +83,7 @@ public: void reserveThread(); void releaseThread(); - void waitForDone(); - bool waitForDone(int msecs); + bool waitForDone(int msecs = -1); }; QT_END_NAMESPACE diff --git a/src/corelib/thread/qthreadpool_p.h b/src/corelib/thread/qthreadpool_p.h index 910e0b0714..760732993d 100644 --- a/src/corelib/thread/qthreadpool_p.h +++ b/src/corelib/thread/qthreadpool_p.h @@ -82,7 +82,7 @@ public: void startThread(QRunnable *runnable = 0); void reset(); - bool waitForDone(int msecs = -1); + bool waitForDone(int msecs); void stealRunnable(QRunnable *); mutable QMutex mutex; |