From 34fe9232dbf6a9fe58ebc4c7680bb67d2f642c40 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 10 Jun 2019 11:08:29 +0200 Subject: Port from QAtomic::load() to loadRelaxed() Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz --- tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib/thread/qthreadonce') diff --git a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp index a9af182ed8..710288af9e 100644 --- a/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/corelib/thread/qthreadonce/tst_qthreadonce.cpp @@ -56,7 +56,7 @@ class SingletonObject: public QObject Q_OBJECT public: static int runCount; - SingletonObject() { val.store(42); ++runCount; } + SingletonObject() { val.storeRelaxed(42); ++runCount; } ~SingletonObject() { } QBasicAtomicInt val; @@ -112,7 +112,7 @@ void tst_QThreadOnce::sameThread() QCOMPARE(controlVariable, 1); static QSingleton s; - QTEST((int)s->val.load(), "expectedValue"); + QTEST((int)s->val.loadRelaxed(), "expectedValue"); s->val.ref(); QCOMPARE(SingletonObject::runCount, 1); @@ -134,7 +134,7 @@ void tst_QThreadOnce::multipleThreads() QCOMPARE(controlVariable, 0); // nothing must have set them yet SingletonObject::runCount = 0; - IncrementThread::runCount.store(0); + IncrementThread::runCount.storeRelaxed(0); // wait for all of them to be ready sem2.acquire(NumberOfThreads); @@ -145,7 +145,7 @@ void tst_QThreadOnce::multipleThreads() delete parent; QCOMPARE(controlVariable, 1); - QCOMPARE((int)IncrementThread::runCount.load(), NumberOfThreads); + QCOMPARE((int)IncrementThread::runCount.loadRelaxed(), NumberOfThreads); QCOMPARE(SingletonObject::runCount, 1); } -- cgit v1.2.3