summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthreadpool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
-rw-r--r--src/corelib/thread/qthreadpool.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index 94b0aff4511..fee6354b0aa 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -43,6 +43,7 @@
#include "qcoreapplication.h"
#include <algorithm>
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -274,16 +275,16 @@ bool QThreadPoolPrivate::tooManyThreadsActive() const
void QThreadPoolPrivate::startThread(QRunnable *runnable)
{
Q_ASSERT(runnable != nullptr);
- QScopedPointer<QThreadPoolThread> thread(new QThreadPoolThread(this));
+ auto thread = std::make_unique<QThreadPoolThread>(this);
if (objectName.isEmpty())
objectName = QLatin1String("Thread (pooled)");
thread->setObjectName(objectName);
- Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
- allThreads.insert(thread.data());
+ Q_ASSERT(!allThreads.contains(thread.get())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
+ allThreads.insert(thread.get());
++activeThreads;
thread->runnable = runnable;
- thread.take()->start(threadPriority);
+ thread.release()->start(threadPriority);
}
/*!