qt5base-lts/tests/auto/corelib/thread
Thiago Macieira 634f82f1f1 Add a testAndSet overload to the atomics that returns the current value
This is extremely useful, since the most common action after a failed
compare-and-swap is to loop around, trying again with the current
value as found in memory.

Code currently written as:
    do {
        Type value = atomic.load();
        ...
    } while (!atomic.testAndSetRelaxed(value, desired));

Becomes:
    Type value = atomic.load();
    do {
        ...
    } while (!atomic.testAndSetRelaxed(value, desired, value));

In most CPU architectures, the value that was found in memory is known
to the compare-and-swap code, so this is more efficient than the
previous code. In architectures where the value is not known, the new
code is no worse than before.

The implementation sometimes modified an existing function, sometimes
it added a new one, depending on whether more registers were needed in
the assembly (like ARMv6-7), the code became more complex (ARMv5), the
optimizer failed (C++11), or it was just plain equivalent (MIPS).

Change-Id: I7d6d200ea9746ec8978a0c1e1969dbc3580b9285
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-02-16 05:12:26 +01:00
..
qatomicint Add a testAndSet overload to the atomics that returns the current value 2014-02-16 05:12:26 +01:00
qatomicinteger Add a testAndSet overload to the atomics that returns the current value 2014-02-16 05:12:26 +01:00
qatomicpointer Add a testAndSet overload to the atomics that returns the current value 2014-02-16 05:12:26 +01:00
qfuture Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qfuturesynchronizer Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qfuturewatcher Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qmutex tst_QMutex: fix a race 2013-09-23 02:47:49 +02:00
qmutexlocker Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qreadlocker Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qreadwritelock Fix test compilation on WinRT 2013-11-26 20:29:09 +01:00
qresultstore Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qsemaphore Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qthread Winrt: Skip qthread autotests, which are not supported (yet) 2013-10-02 12:36:09 +02:00
qthreadonce Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qthreadpool tst_qthreadpool: fix memory leak 2013-11-28 09:14:11 +01:00
qthreadstorage WinRT: Fix various test compilations 2013-10-02 12:36:05 +02:00
qwaitcondition Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
qwritelocker Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
thread.pro Replace the type-based QAtomicIntegerTraits with a size-based one 2014-01-30 18:06:27 +01:00