QEventDispatcherWin32: relax memory ordering on setting wakeUps flag

There is no need in 'acquire' operation for the next reasons:

  - wakeUps is simply used as an atomic boolean that does not require
    ordering with other loads or stores;
  - any of testAndSet...() always gets a latest version of wakeUps.

Change-Id: Ica38fc62bc181166995946dee9d6887c71d87cec
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Alex Trotsenko 2020-04-10 19:49:41 +03:00
parent fd550c943f
commit 6ce4c7d002
1 changed files with 1 additions and 1 deletions

View File

@ -971,7 +971,7 @@ int QEventDispatcherWin32::remainingTime(int timerId)
void QEventDispatcherWin32::wakeUp()
{
Q_D(QEventDispatcherWin32);
if (d->internalHwnd && d->wakeUps.testAndSetAcquire(0, 1)) {
if (d->internalHwnd && d->wakeUps.testAndSetRelaxed(0, 1)) {
// post a WM_QT_SENDPOSTEDEVENTS to this thread if there isn't one already pending
if (!PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0))
qErrnoWarning("QEventDispatcherWin32::wakeUp: Failed to post a message");