summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qatomic.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2011-07-31 17:40:40 -0300
committerQt by Nokia <qt-info@nokia.com>2012-01-20 12:26:26 +0100
commit1f843ca39ee59c5304009faf308ddce791614a02 (patch)
tree31e9e0bd87f30ecb26f93846a6380759b231013b /src/corelib/thread/qatomic.h
parentf188d8a005e7c06869aa96bddb82053178c554e9 (diff)
Add the new QBasicAtomicXXX implementation - no backends yet
The new implementation is API- and ABI-compatible with the old implementation, provided that QBasicAtomicInt isn't used as an argument in a function call or the return value: now, QBasicAtomicInt is a typedef to QBasicAtomicInteger<int>. The new design is based on CRTP: the QGenericAtomicOps template class takes as a template parameter the derived class itself. This way, we implement a "poor man's virtual" without a virtual table and everything is inline. QGenericAtomicOps implements most of the atomics code that is repeated in many classes all over: * Acquire semantics are obtained by placing an acquire barrier after the Relaxed operation * Release semantics are obtained by placing a release barrier before the Relaxed operation * Ordered semantics are obtained by placing an ordered barrier before the Relaxed operation (either way would be fine) * fetchAndStoreRelaxed and fetchAndAddRelaxed are implemented on top of testAndSetRelaxed * ref and deref are implemented on top of fetchAndAddRelaxed It also adds load, loadAcquire, store and storeRelease: the default implementations of loadAcquire and storeRelease operate on a volatile variable and add barriers. There are no direct operators for accessing the value. Each architecture-specific implementation can override any of the functions or the memory barrier functions. It must implement at least the testAndSetRelaxed function. In addition, by specialising one template class, the implementations can allow QBasicAtomicInteger for additional types (of different sizes). At the very least, int, unsigned and pointers must be supported. Change-Id: I6da647e225bb330d3cfc16f84d0e7849dff85ec7 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/thread/qatomic.h')
-rw-r--r--src/corelib/thread/qatomic.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index 07350ecfcd..46026f3000 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -44,7 +44,7 @@
#ifndef QATOMIC_H
#define QATOMIC_H
-#include <QtCore/qoldbasicatomic.h>
+#include <QtCore/qbasicatomic.h>
QT_BEGIN_HEADER