From 1f2a230b898af9da73463bca27b5883d36da7a91 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 6 May 2024 11:27:56 -0700 Subject: QThreadPool: store the expiryTimeout in a std::chrono type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ahmad Samir --- src/corelib/thread/qthreadpool.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/corelib/thread/qthreadpool.cpp') diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 69d9afc77a6..c7531111da7 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -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(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 -- cgit v1.2.3