QCoreApplication: fold two atomic ops into one
The old code performed a fetchAndSubAcquire() followed by an implicit loadAcquire() in the Q_ASSERT(). But fetchAndSub() returns the old value, so we don't need to re-load it; we just need to store the result of fetchAndSub(). We need to adjust the assertion, of course, since we're now checking the old value, which is one more than a load would show, so replace ≥ 0 with > 0. Amends the start of the public history. Pick-to: 6.8 6.5 Change-Id: I6f6804261cd56a5a8bbb276ed7a0ac360c94195e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit f4e7eebd27c1fed7bbeb646b38ea020c97731466) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 5430116ed3504aa5d44cd314bedb3441701263f2)
This commit is contained in:
parent
ff6ba98759
commit
5aebbc81d8
@ -1863,8 +1863,9 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
|
||||
QEvent *e = pe.event;
|
||||
QObject * r = pe.receiver;
|
||||
|
||||
r->d_func()->postedEvents.fetchAndSubAcquire(1);
|
||||
Q_ASSERT(r->d_func()->postedEvents >= 0);
|
||||
[[maybe_unused]]
|
||||
const auto previous = r->d_func()->postedEvents.fetchAndSubAcquire(1);
|
||||
Q_ASSERT(previous > 0);
|
||||
|
||||
// next, update the data structure so that we're ready
|
||||
// for the next event.
|
||||
|
Loading…
x
Reference in New Issue
Block a user