QThreadPool: store the expiryTimeout in a std::chrono type
For future-proofing. I'm not changing the front-end API because it's seldom used. Task-number: QTBUG-125107 Change-Id: Ic5b1273bb0204c31afd8fffd17ccf9ac42f57762 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
179e79b18d
commit
1f2a230b89
@ -593,18 +593,17 @@ bool QThreadPool::tryStart(QRunnable *runnable)
|
||||
|
||||
int QThreadPool::expiryTimeout() const
|
||||
{
|
||||
using namespace std::chrono;
|
||||
Q_D(const QThreadPool);
|
||||
QMutexLocker locker(&d->mutex);
|
||||
return d->expiryTimeout;
|
||||
return duration_cast<milliseconds>(d->expiryTimeout).count();
|
||||
}
|
||||
|
||||
void QThreadPool::setExpiryTimeout(int expiryTimeout)
|
||||
{
|
||||
Q_D(QThreadPool);
|
||||
QMutexLocker locker(&d->mutex);
|
||||
if (d->expiryTimeout == expiryTimeout)
|
||||
return;
|
||||
d->expiryTimeout = expiryTimeout;
|
||||
d->expiryTimeout = std::chrono::milliseconds(expiryTimeout);
|
||||
}
|
||||
|
||||
/*! \property QThreadPool::maxThreadCount
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
QWaitCondition noActiveThreads;
|
||||
QString objectName;
|
||||
|
||||
int expiryTimeout = 30000;
|
||||
std::chrono::duration<int, std::milli> expiryTimeout = std::chrono::seconds(30);
|
||||
int requestedMaxThreadCount = QThread::idealThreadCount(); // don't use this directly
|
||||
int reservedThreads = 0;
|
||||
int activeThreads = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user