summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutureinterface_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-12-06 10:12:58 -0800
committerThiago Macieira <thiago.macieira@intel.com>2022-12-06 22:24:14 -0800
commit04e668f6ba57c83e509ce7cbba929c3e7139671d (patch)
treed2a359da7ae6d287c814e180381e9dbe37f64832 /src/corelib/thread/qfutureinterface_p.h
parente02933a17c3615bc6e86f571fc6946390f43bd16 (diff)
QFutureInterfaceBasePrivate: pack to remove padding
This structure was 216 bytes with 3 padding regions: 3 bytes between continuationState and refCount, 4 bytes between m_progressValue and m_progress, and 1 byte at the end after the booleans. The total of 8 bytes can be neatly reduced. And since it's now a multiple of 16, we should get an effective 16 byte reduction in malloc()ed size. Change-Id: I69ecc04064514f939896fffd172e46d1d68cb28b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/thread/qfutureinterface_p.h')
-rw-r--r--src/corelib/thread/qfutureinterface_p.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index 6258e61de7..92a1072591 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -143,9 +143,6 @@ public:
std::function<void(const QFutureInterfaceBase &)> continuation;
QFutureInterfaceBasePrivate *continuationData = nullptr;
- enum ContinuationState : quint8 { Default, Canceled, Cleaned };
- std::atomic<ContinuationState> continuationState { Default };
-
RefCount refCount = 1;
QAtomicInt state; // reads and writes can happen unprotected, both must be atomic
@@ -163,6 +160,9 @@ public:
bool isValid = false;
bool hasException = false;
+ enum ContinuationState : quint8 { Default, Canceled, Cleaned };
+ std::atomic<ContinuationState> continuationState { Default };
+
inline QThreadPool *pool() const
{ return m_pool ? m_pool : QThreadPool::globalInstance(); }