summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
-rw-r--r--src/corelib/thread/qthread.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index f804ab8b9d3..64a6645db21 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -1119,12 +1119,16 @@ void QThread::setTerminationEnabled(bool)
// No threads: so we can just use static variables
Q_CONSTINIT static QThreadData *data = nullptr;
-QThreadData *QThreadData::current()
+QThreadData *QThreadData::currentThreadData() noexcept
{
- if (!data) {
- data = new QThreadData;
- data->thread = new QAdoptedThread(data);
- }
+ return data;
+}
+
+QThreadData *QThreadData::createCurrentThreadData()
+{
+ Q_ASSERT(!currentThreadData());
+ data = new QThreadData;
+ data->thread = new QAdoptedThread(data);
return data;
}