1// Copyright (C) 2011 Thiago Macieira <thiago@kde.org>
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QGENERICATOMIC_H
6#define QGENERICATOMIC_H
7
8#include <QtCore/qcompilerdetection.h>
9#include <QtCore/qtconfigmacros.h>
10#include <QtCore/qtypes.h>
11
12QT_BEGIN_NAMESPACE
13
14#if 0
15// silence syncqt warnings
16QT_END_NAMESPACE
17#pragma qt_sync_skip_header_check
18#pragma qt_sync_stop_processing
19#endif
20
21template<int Size> struct QAtomicOpsSupport
22{
23 enum { IsSupported = (Size == sizeof(int) || Size == sizeof(qptrdiff)) };
24};
25
26template <typename T> struct QAtomicAdditiveType
27{
28 typedef T AdditiveT;
29 static const int AddScale = 1;
30};
31template <typename T> struct QAtomicAdditiveType<T *>
32{
33 typedef qptrdiff AdditiveT;
34 static const int AddScale = sizeof(T);
35};
36
37QT_END_NAMESPACE
38#endif // QGENERICATOMIC_H
39

source code of qtbase/src/corelib/thread/qgenericatomic.h