summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutureinterface_p.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-21 11:23:30 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-03-22 13:12:15 +0100
commitabd7496fba00a9de5f4c6e1ab9696f0679b8fac3 (patch)
tree43697e3a292976ef29dc61a111f70fae64aa0532 /src/corelib/thread/qfutureinterface_p.h
parentb3544bfd4642c3b256c39d20bc58a9019d3e4d25 (diff)
QFutureInterfaceBasePrivate: reorder members to save 8 bytes
And use in-class member initialization where applicable. Task-number: QTBUG-92045 Change-Id: I54715709f2d8e54017311f45016c16d86ed3078b Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Diffstat (limited to 'src/corelib/thread/qfutureinterface_p.h')
-rw-r--r--src/corelib/thread/qfutureinterface_p.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index df71d3d4b6..25421b064c 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -159,23 +159,30 @@ public:
// T: accessed from executing thread
// Q: accessed from the waiting/querying thread
- RefCount refCount;
mutable QMutex m_mutex;
- QWaitCondition waitCondition;
+ QBasicMutex continuationMutex;
QList<QFutureCallOutInterface *> outputConnections;
- int m_progressValue; // TQ
- int m_progressMinimum; // TQ
- int m_progressMaximum; // TQ
- QAtomicInt state; // reads and writes can happen unprotected, both must be atomic
QElapsedTimer progressTime;
+ QWaitCondition waitCondition;
QWaitCondition pausedWaitCondition;
+ // ### TODO: put m_results and m_exceptionStore into a union (see QTBUG-92045)
QtPrivate::ResultStoreBase m_results;
- bool manualProgress; // only accessed from executing thread
- int m_expectedResultCount;
QtPrivate::ExceptionStore m_exceptionStore;
QString m_progressText;
- QRunnable *runnable;
- QThreadPool *m_pool;
+ QRunnable *runnable = nullptr;
+ QThreadPool *m_pool = nullptr;
+ // Wrapper for continuation
+ std::function<void(const QFutureInterfaceBase &)> continuation;
+
+ RefCount refCount = 1;
+ QAtomicInt state; // reads and writes can happen unprotected, both must be atomic
+ int m_progressValue = 0; // TQ
+ int m_progressMinimum = 0; // TQ
+ int m_progressMaximum = 0; // TQ
+ int m_expectedResultCount = 0;
+ bool manualProgress = false; // only accessed from executing thread
+ bool launchAsync = false;
+ bool isValid = false;
inline QThreadPool *pool() const
{ return m_pool ? m_pool : QThreadPool::globalInstance(); }
@@ -194,12 +201,6 @@ public:
void setState(QFutureInterfaceBase::State state);
- // Wrapper for continuation
- std::function<void(const QFutureInterfaceBase &)> continuation;
- QBasicMutex continuationMutex;
-
- bool launchAsync = false;
- bool isValid = false;
};
QT_END_NAMESPACE