QtBase  v6.3.1
Public Member Functions | Related Functions | List of all members
QAtomicPointer< T > Class Template Reference

The QAtomicPointer class is a template class that provides platform-independent atomic operations on pointers. More...

#include <qatomic.h>

Inheritance diagram for QAtomicPointer< T >:
Inheritance graph
[legend]
Collaboration diagram for QAtomicPointer< T >:
Collaboration graph
[legend]

Public Member Functions

 QAtomicPointer (T *value=nullptr) noexcept
 
 QAtomicPointer (const QAtomicPointer< T > &other) noexcept
 
QAtomicPointer< T > & operator= (const QAtomicPointer< T > &other) noexcept
 
- Public Member Functions inherited from QBasicAtomicPointer< T >
Type loadRelaxed () const noexcept
 
void storeRelaxed (Type newValue) noexcept
 
 operator Type () const noexcept
 
Type operator= (Type newValue) noexcept
 
QBasicAtomicPointeroperator= (const QBasicAtomicPointer &)=delete
 
QBasicAtomicPointeroperator= (const QBasicAtomicPointer &) volatile=delete
 
Type loadAcquire () const noexcept
 
void storeRelease (Type newValue) noexcept
 
bool testAndSetRelaxed (Type expectedValue, Type newValue) noexcept
 
bool testAndSetRelaxed (Type expectedValue, Type newValue, Type &currentValue) noexcept
 
bool testAndSetAcquire (Type expectedValue, Type newValue) noexcept
 
bool testAndSetAcquire (Type expectedValue, Type newValue, Type &currentValue) noexcept
 
bool testAndSetRelease (Type expectedValue, Type newValue) noexcept
 
bool testAndSetRelease (Type expectedValue, Type newValue, Type &currentValue) noexcept
 
bool testAndSetOrdered (Type expectedValue, Type newValue) noexcept
 
bool testAndSetOrdered (Type expectedValue, Type newValue, Type &currentValue) noexcept
 
Type fetchAndStoreRelaxed (Type newValue) noexcept
 
Type fetchAndStoreAcquire (Type newValue) noexcept
 
Type fetchAndStoreRelease (Type newValue) noexcept
 
Type fetchAndStoreOrdered (Type newValue) noexcept
 
Type fetchAndAddRelaxed (qptrdiff valueToAdd) noexcept
 
Type fetchAndAddAcquire (qptrdiff valueToAdd) noexcept
 
Type fetchAndAddRelease (qptrdiff valueToAdd) noexcept
 
Type fetchAndAddOrdered (qptrdiff valueToAdd) noexcept
 
Type fetchAndSubRelaxed (qptrdiff valueToAdd) noexcept
 
Type fetchAndSubAcquire (qptrdiff valueToAdd) noexcept
 
Type fetchAndSubRelease (qptrdiff valueToAdd) noexcept
 
Type fetchAndSubOrdered (qptrdiff valueToAdd) noexcept
 
Type operator++ () noexcept
 
Type operator++ (int) noexcept
 
Type operator-- () noexcept
 
Type operator-- (int) noexcept
 
Type operator+= (qptrdiff valueToAdd) noexcept
 
Type operator-= (qptrdiff valueToSub) noexcept
 
 QBasicAtomicPointer ()=default
 
constexpr QBasicAtomicPointer (Type value) noexcept
 
 QBasicAtomicPointer (const QBasicAtomicPointer &)=delete
 

Related Functions

(Note that these are not member functions.)

 QT_BEGIN_NAMESPACE
 

Additional Inherited Members

- Public Types inherited from QBasicAtomicPointer< T >
typedef TType
 
typedef QAtomicOps< TypeOps
 
typedef Ops::Type AtomicType
 
- Static Public Member Functions inherited from QBasicAtomicPointer< T >
static constexpr bool isTestAndSetNative () noexcept
 
static constexpr bool isTestAndSetWaitFree () noexcept
 
static constexpr bool isFetchAndStoreNative () noexcept
 
static constexpr bool isFetchAndStoreWaitFree () noexcept
 
static constexpr bool isFetchAndAddNative () noexcept
 
static constexpr bool isFetchAndAddWaitFree () noexcept
 
- Public Attributes inherited from QBasicAtomicPointer< T >
AtomicType _q_value
 

Detailed Description

template<typename T>
class QAtomicPointer< T >

The QAtomicPointer class is a template class that provides platform-independent atomic operations on pointers.

\macro Q_ATOMIC_INTnn_IS_SUPPORTED

This macro is defined if atomic integers of size {nn} (in bits) are supported in this compiler / architecture combination. Q_ATOMIC_INT32_IS_SUPPORTED is always defined.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_REFERENCE_COUNTING_IS_ALWAYS_NATIVE

This macro is defined if and only if all generations of your processor support atomic reference counting.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic reference counting. Use the QAtomicInteger<T>::isReferenceCountingNative() function to check what your processor supports.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_REFERENCE_COUNTING_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic reference counting.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_REFERENCE_COUNTING_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_INTnn_REFERENCE_COUNTING_IS_ALWAYS_NATIVE to indicate that the reference counting is wait-free.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_TEST_AND_SET_IS_ALWAYS_NATIVE

This macro is defined if and only if your processor supports atomic test-and-set on integers.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_TEST_AND_SET_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic test-and-set on integers. Use the QAtomicInteger<T>::isTestAndSetNative() function to check what your processor supports.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_TEST_AND_SET_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic test-and-set on integers.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_TEST_AND_SET_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_INTnn_TEST_AND_SET_IS_ALWAYS_NATIVE to indicate that the atomic test-and-set on integers is wait-free.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_STORE_IS_ALWAYS_NATIVE

This macro is defined if and only if your processor supports atomic fetch-and-store on integers.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_STORE_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic fetch-and-store on integers. Use the QAtomicInteger<T>::isFetchAndStoreNative() function to check what your processor supports.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_STORE_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic fetch-and-store on integers.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_STORE_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_INTnn_FETCH_AND_STORE_IS_ALWAYS_NATIVE to indicate that the atomic fetch-and-store on integers is wait-free.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_ADD_IS_ALWAYS_NATIVE

This macro is defined if and only if your processor supports atomic fetch-and-add on integers.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_ADD_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic fetch-and-add on integers. Use the QAtomicInteger<T>::isFetchAndAddNative() function to check what your processor supports.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_ADD_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic fetch-and-add on integers.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\macro Q_ATOMIC_INTnn_FETCH_AND_ADD_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_INTnn_FETCH_AND_ADD_IS_ALWAYS_NATIVE to indicate that the atomic fetch-and-add on integers is wait-free.

{nn} is the size of the integer, in bits (8, 16, 32 or 64).

\inmodule QtCore

Since
4.4

For atomic operations on integers, see the QAtomicInteger class.

An atomic operation is a complex operation that completes without interruption. The QAtomicPointer class provides atomic test-and-set, fetch-and-store, and fetch-and-add for pointers.

Definition at line 171 of file qatomic.h.

Constructor & Destructor Documentation

◆ QAtomicPointer() [1/2]

template<typename T >
template< typename T > QAtomicPointer< T >::QAtomicPointer ( T value = nullptr)
inlinenoexcept

Constructs a QAtomicPointer with the given value.

Definition at line 177 of file qatomic.h.

Here is the call graph for this function:

◆ QAtomicPointer() [2/2]

template<typename T >
template< typename T > QAtomicPointer< T >::QAtomicPointer ( const QAtomicPointer< T > &  other)
inlinenoexcept

Constructs a copy of other.

Definition at line 182 of file qatomic.h.

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

template<typename T >
template< typename T > QAtomicPointer & QAtomicPointer< T >::operator= ( const QAtomicPointer< T > &  other)
inlinenoexcept

Assigns other to this QAtomicPointer and returns a reference to this QAtomicPointer.

Definition at line 190 of file qatomic.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ QT_BEGIN_NAMESPACE

template<typename T >
QAtomicPointer< T >::QT_BEGIN_NAMESPACE
related

\macro Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE

This macro is defined if and only if your processor supports atomic test-and-set on pointers.

\macro Q_ATOMIC_POINTER_TEST_AND_SET_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic test-and-set on pointers. Use the QAtomicPointer::isTestAndSetNative() function to check what your processor supports.

\macro Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic test-and-set on pointers.

\macro Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE to indicate that the atomic test-and-set on pointers is wait-free.

\macro Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE

This macro is defined if and only if your processor supports atomic fetch-and-store on pointers.

\macro Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic fetch-and-store on pointers. Use the QAtomicPointer::isFetchAndStoreNative() function to check what your processor supports.

\macro Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic fetch-and-store on pointers.

\macro Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE to indicate that the atomic fetch-and-store on pointers is wait-free.

\macro Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE

This macro is defined if and only if your processor supports atomic fetch-and-add on pointers.

\macro Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_SOMETIMES_NATIVE

This macro is defined when only certain generations of the processor support atomic fetch-and-add on pointers. Use the QAtomicPointer::isFetchAndAddNative() function to check what your processor supports.

\macro Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE

This macro is defined when the hardware does not support atomic fetch-and-add on pointers.

\macro Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE

This macro is defined together with Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE to indicate that the atomic fetch-and-add on pointers is wait-free.

Definition at line 1703 of file qatomic.cpp.


The documentation for this class was generated from the following files: