QThreadPool: unify waitForDone() overloads
Change-Id: I1515a65fab37588372794422a43ed09ac076e108 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
cbaf52b099
commit
dab2e1fea7
@ -410,8 +410,7 @@ QThreadPool::QThreadPool(QObject *parent)
|
|||||||
*/
|
*/
|
||||||
QThreadPool::~QThreadPool()
|
QThreadPool::~QThreadPool()
|
||||||
{
|
{
|
||||||
d_func()->waitForDone();
|
waitForDone();
|
||||||
d_func()->reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -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
|
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;
|
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)
|
bool QThreadPool::waitForDone(int msecs)
|
||||||
{
|
{
|
||||||
|
@ -83,8 +83,7 @@ public:
|
|||||||
void reserveThread();
|
void reserveThread();
|
||||||
void releaseThread();
|
void releaseThread();
|
||||||
|
|
||||||
void waitForDone();
|
bool waitForDone(int msecs = -1);
|
||||||
bool waitForDone(int msecs);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
|
|
||||||
void startThread(QRunnable *runnable = 0);
|
void startThread(QRunnable *runnable = 0);
|
||||||
void reset();
|
void reset();
|
||||||
bool waitForDone(int msecs = -1);
|
bool waitForDone(int msecs);
|
||||||
void stealRunnable(QRunnable *);
|
void stealRunnable(QRunnable *);
|
||||||
|
|
||||||
mutable QMutex mutex;
|
mutable QMutex mutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user