Qt 4.8
Public Functions | Static Public Functions | List of all members
QAtomicInt Class Reference

The QAtomicInt class provides platform-independent atomic operations on integers. More...

#include <qatomic.h>

Inheritance diagram for QAtomicInt:
QBasicAtomicInt

Public Functions

bool deref ()
 Atomically decrements the value of this QAtomicInt. More...
 
int fetchAndAddAcquire (int valueToAdd)
 Atomic fetch-and-add. More...
 
int fetchAndAddOrdered (int valueToAdd)
 Atomic fetch-and-add. More...
 
int fetchAndAddRelaxed (int valueToAdd)
 Atomic fetch-and-add. More...
 
int fetchAndAddRelease (int valueToAdd)
 Atomic fetch-and-add. More...
 
int fetchAndStoreAcquire (int newValue)
 Atomic fetch-and-store. More...
 
int fetchAndStoreOrdered (int newValue)
 Atomic fetch-and-store. More...
 
int fetchAndStoreRelaxed (int newValue)
 Atomic fetch-and-store. More...
 
int fetchAndStoreRelease (int newValue)
 Atomic fetch-and-store. More...
 
 operator int () const
 Returns the value stored by the QAtomicInt object as an integer. More...
 
bool operator! () const
 Returns true is the value of this QAtomicInt is zero; otherwise returns false. More...
 
bool operator!= (int value) const
 Returns true if the value of this QAtomicInt is not equal to value; otherwise returns false. More...
 
QAtomicIntoperator= (int value)
 Assigns the value to this QAtomicInt and returns a reference to this QAtomicInt. More...
 
QAtomicIntoperator= (const QAtomicInt &other)
 Assigns other to this QAtomicInt and returns a reference to this QAtomicInt. More...
 
bool operator== (int value) const
 Returns true if the value is equal to the value in this QAtomicInt; otherwise returns false. More...
 
 QAtomicInt (int value=0)
 Constructs a QAtomicInt with the given value. More...
 
 QAtomicInt (const QAtomicInt &other)
 Constructs a copy of other. More...
 
bool ref ()
 Atomically increments the value of this QAtomicInt. More...
 
bool testAndSetAcquire (int expectedValue, int newValue)
 Atomic test-and-set. More...
 
bool testAndSetOrdered (int expectedValue, int newValue)
 Atomic test-and-set. More...
 
bool testAndSetRelaxed (int expectedValue, int newValue)
 Atomic test-and-set. More...
 
bool testAndSetRelease (int expectedValue, int newValue)
 Atomic test-and-set. More...
 
- Public Functions inherited from QBasicAtomicInt
bool deref ()
 
int fetchAndAddAcquire (int valueToAdd)
 
int fetchAndAddOrdered (int valueToAdd)
 
int fetchAndAddRelaxed (int valueToAdd)
 
int fetchAndAddRelease (int valueToAdd)
 
int fetchAndStoreAcquire (int newValue)
 
int fetchAndStoreOrdered (int newValue)
 
int fetchAndStoreRelaxed (int newValue)
 
int fetchAndStoreRelease (int newValue)
 
 operator int () const
 
bool operator! () const
 
bool operator!= (int value) const
 
QBasicAtomicIntoperator= (int value)
 
bool operator== (int value) const
 
bool ref ()
 
bool testAndSetAcquire (int expectedValue, int newValue)
 
bool testAndSetOrdered (int expectedValue, int newValue)
 
bool testAndSetRelaxed (int expectedValue, int newValue)
 
bool testAndSetRelease (int expectedValue, int newValue)
 

Static Public Functions

static bool isFetchAndAddNative ()
 Returns true if fetch-and-add is implemented using atomic processor instructions, false otherwise. More...
 
static bool isFetchAndAddWaitFree ()
 Returns true if atomic fetch-and-add is wait-free, false otherwise. More...
 
static bool isFetchAndStoreNative ()
 Returns true if fetch-and-store is implemented using atomic processor instructions, false otherwise. More...
 
static bool isFetchAndStoreWaitFree ()
 Returns true if atomic fetch-and-store is wait-free, false otherwise. More...
 
static bool isReferenceCountingNative ()
 Returns true if reference counting is implemented using atomic processor instructions, false otherwise. More...
 
static bool isReferenceCountingWaitFree ()
 Returns true if atomic reference counting is wait-free, false otherwise. More...
 
static bool isTestAndSetNative ()
 Returns true if test-and-set is implemented using atomic processor instructions, false otherwise. More...
 
static bool isTestAndSetWaitFree ()
 Returns true if atomic test-and-set is wait-free, false otherwise. More...
 
- Static Public Functions inherited from QBasicAtomicInt
static bool isFetchAndAddNative ()
 
static bool isFetchAndAddWaitFree ()
 
static bool isFetchAndStoreNative ()
 
static bool isFetchAndStoreWaitFree ()
 
static bool isReferenceCountingNative ()
 
static bool isReferenceCountingWaitFree ()
 
static bool isTestAndSetNative ()
 
static bool isTestAndSetWaitFree ()
 

Additional Inherited Members

- Public Variables inherited from QBasicAtomicInt
volatile int _q_value
 

Detailed Description

The QAtomicInt class provides platform-independent atomic operations on integers.

Since
4.4

For atomic operations on pointers, see the QAtomicPointer class.

An atomic operation is a complex operation that completes without interruption. The QAtomicInt class provides atomic reference counting, test-and-set, fetch-and-store, and fetch-and-add for integers.

Non-atomic convenience operators

For convenience, QAtomicInt provides integer comparison, cast, and assignment operators. Note that a combination of these operators is not an atomic operation.

The Atomic API

Reference counting

The ref() and deref() functions provide an efficient reference counting API. The return value of these functions are used to indicate when the last reference has been released. These functions allow you to implement your own implicitly shared classes.

MySharedType &MySharedType::operator=(const MySharedType &other)
{
(void) other.data->atomicInt.ref();
if (!data->atomicInt.deref()) {
// The last reference has been released
delete d;
}
d = other.d;
return *this;
}

Memory ordering

QAtomicInt provides several implementations of the atomic test-and-set, fetch-and-store, and fetch-and-add functions. Each implementation defines a memory ordering semantic that describes how memory accesses surrounding the atomic instruction are executed by the processor. Since many modern architectures allow out-of-order execution and memory ordering, using the correct semantic is necessary to ensure that your application functions properly on all processors.

Test-and-set

If the current value of the QAtomicInt is an expected value, the test-and-set functions assign a new value to the QAtomicInt and return true. If values are not the same, these functions do nothing and return false. This operation equates to the following code:

if (currentValue == expectedValue) {
currentValue = newValue;
return true;
}
return false;

There are 4 test-and-set functions: testAndSetRelaxed(), testAndSetAcquire(), testAndSetRelease(), and testAndSetOrdered(). See above for an explanation of the different memory ordering semantics.

Fetch-and-store

The atomic fetch-and-store functions read the current value of the QAtomicInt and then assign a new value, returning the original value. This operation equates to the following code:

int originalValue = currentValue;
currentValue = newValue;
return originalValue;

There are 4 fetch-and-store functions: fetchAndStoreRelaxed(), fetchAndStoreAcquire(), fetchAndStoreRelease(), and fetchAndStoreOrdered(). See above for an explanation of the different memory ordering semantics.

Fetch-and-add

The atomic fetch-and-add functions read the current value of the QAtomicInt and then add the given value to the current value, returning the original value. This operation equates to the following code:

int originalValue = currentValue;
currentValue += valueToAdd;
return originalValue;

There are 4 fetch-and-add functions: fetchAndAddRelaxed(), fetchAndAddAcquire(), fetchAndAddRelease(), and fetchAndAddOrdered(). See above for an explanation of the different memory ordering semantics.

Feature Tests for the Atomic API

Providing a platform-independent atomic API that works on all processors is challenging. The API provided by QAtomicInt is guaranteed to work atomically on all processors. However, since not all processors implement support for every operation provided by QAtomicInt, it is necessary to expose information about the processor.

You can check at compile time which features are supported on your hardware using various macros. These will tell you if your hardware always, sometimes, or does not support a particular operation. The macros have the form Q_ATOMIC_INT_OPERATION_IS_HOW_NATIVE. OPERATION is one of REFERENCE_COUNTING, TEST_AND_SET, FETCH_AND_STORE, or FETCH_AND_ADD, and HOW is one of ALWAYS, SOMETIMES, or NOT. There will always be exactly one defined macro per operation. For example, if Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE is defined, neither Q_ATOMIC_INT_REFERENCE_COUNTING_IS_SOMETIMES_NATIVE nor Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE will be defined.

An operation that completes in constant time is said to be wait-free. Such operations are not implemented using locks or loops of any kind. For atomic operations that are always supported, and that are wait-free, Qt defines the Q_ATOMIC_INT_OPERATION_IS_WAIT_FREE in addition to the Q_ATOMIC_INT_OPERATION_IS_ALWAYS_NATIVE.

In cases where an atomic operation is only supported in newer generations of the processor, QAtomicInt also provides a way to check at runtime what your hardware supports with the isReferenceCountingNative(), isTestAndSetNative(), isFetchAndStoreNative(), and isFetchAndAddNative() functions. Wait-free implementations can be detected using the isReferenceCountingWaitFree(), isTestAndSetWaitFree(), isFetchAndStoreWaitFree(), and isFetchAndAddWaitFree() functions.

Below is a complete list of all feature macros for QAtomicInt:

See also
QAtomicPointer

Definition at line 55 of file qatomic.h.

Constructors and Destructors

◆ QAtomicInt() [1/2]

QAtomicInt::QAtomicInt ( int  value = 0)
inline

Constructs a QAtomicInt with the given value.

Definition at line 58 of file qatomic.h.

59  {
60 #ifdef QT_ARCH_PARISC
61  this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1;
62 #endif
63  _q_value = value;
64  }
volatile int _q_value
Definition: qbasicatomic.h:64

◆ QAtomicInt() [2/2]

QAtomicInt::QAtomicInt ( const QAtomicInt other)
inline

Constructs a copy of other.

Definition at line 65 of file qatomic.h.

66  {
67 #ifdef QT_ARCH_PARISC
68  this->_q_lock[0] = this->_q_lock[1] = this->_q_lock[2] = this->_q_lock[3] = -1;
69 #endif
70  _q_value = other._q_value;
71  }
volatile int _q_value
Definition: qbasicatomic.h:64

Functions

◆ deref()

bool QAtomicInt::deref ( )

Atomically decrements the value of this QAtomicInt.

Returns true if the new value is non-zero, false otherwise.

This function uses ordered memory ordering semantics, which ensures that memory access before and after the atomic operation (in program order) may not be re-ordered.

See also
ref()

Referenced by QDomHandler::characters(), QDBusArgumentPrivate::checkReadAndDetach(), QDBusArgumentPrivate::checkWrite(), QPainterPathPrivateDeleter::cleanup(), QBrushDataPointerDeleter::cleanup(), QUrl::clear(), QDomNodePrivate::clear(), QFontCache::clear(), QResourcePrivate::clear(), QDomNamedNodeMapPrivate::clone(), QDomNodePrivate::cloneNode(), QDomDocumentTypePrivate::cloneNode(), QDomDocumentFragmentPrivate::cloneNode(), QDomCharacterDataPrivate::cloneNode(), QDomAttrPrivate::cloneNode(), QDomElementPrivate::cloneNode(), QDomCDATASectionPrivate::cloneNode(), QDomNotationPrivate::cloneNode(), QDomDocumentPrivate::cloneNode(), QDomDocumentPrivate::createAttribute(), QDomDocumentPrivate::createAttributeNS(), QDomDocumentPrivate::createCDATASection(), QDomDocumentPrivate::createComment(), QDomDocumentPrivate::createDocumentFragment(), QDomImplementation::createDocumentType(), QDomDocumentPrivate::createElement(), QDomDocumentPrivate::createElementNS(), QDomDocumentPrivate::createEntityReference(), QDomDocumentPrivate::createProcessingInstruction(), QDomDocumentPrivate::createTextNode(), QThreadData::deref(), derefEngine(), QIcon::detach(), QGLFramebufferObjectFormat::detach(), QPalette::detach(), QUrl::detach(), QFont::detach(), QFontPrivate::engineForScript(), QImage::format(), QDomDocumentPrivate::importNode(), QFastMutex::lock(), QDomHandler::notationDecl(), QTextDocumentFragment::operator=(), QGLBuffer::operator=(), QIcon::operator=(), QPalette::operator=(), QPaintBuffer::operator=(), QCursor::operator=(), QPersistentModelIndex::operator=(), QFutureInterfaceBase::operator=(), QImage::operator=(), QGLFramebufferObjectFormat::operator=(), QXmlItem::operator=(), QTouchEvent::TouchPoint::operator=(), QDBusConnectionPrivate::processFinishedCall(), QDBusPendingCall::QDBusPendingCall(), qUnregisterResourceData(), QDeclarativeListModelWorkerAgent::release(), QLibraryPrivate::release(), releaseCachedFontEngine(), QDomNodePrivate::removeChild(), QDBusConnectionManager::removeConnection(), QDomNamedNodeMapPrivate::removeNamedItem(), QDomNodePrivate::replaceChild(), QDBusConnectionPrivate::sendWithReply(), QDomElementPrivate::setAttribute(), QDomElementPrivate::setAttributeNS(), QDomAttrPrivate::setNodeValue(), QRawFont::setPixelSize(), QCursor::setShape(), QLibraryPrivate::unload(), QDomHandler::unparsedEntityDecl(), QResource::unregisterResource(), QColormap::~QColormap(), QCursor::~QCursor(), QDBusArgument::~QDBusArgument(), QDBusConnectionManager::~QDBusConnectionManager(), QDomDocumentTypePrivate::~QDomDocumentTypePrivate(), QDomElementPrivate::~QDomElementPrivate(), QDomNodePrivate::~QDomNodePrivate(), QFontEngineData::~QFontEngineData(), QFontEngineMacMulti::~QFontEngineMacMulti(), QFontEngineMulti::~QFontEngineMulti(), QFontPrivate::~QFontPrivate(), QFontSubset::~QFontSubset(), QFutureInterfaceBase::~QFutureInterfaceBase(), QGLBuffer::~QGLBuffer(), QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat(), QGlobalStaticDeleter< QPenPrivate >::~QGlobalStaticDeleter(), QGlobalStaticDeleter< QBrushData >::~QGlobalStaticDeleter(), QIcon::~QIcon(), QIconPrivate::~QIconPrivate(), QImage::~QImage(), QKeySequence::~QKeySequence(), QPaintBuffer::~QPaintBuffer(), QPalette::~QPalette(), QPersistentModelIndex::~QPersistentModelIndex(), QTextDocumentFragment::~QTextDocumentFragment(), QTextItemIntCopy::~QTextItemIntCopy(), QUrl::~QUrl(), QXmlItem::~QXmlItem(), and QTouchEvent::TouchPoint::~TouchPoint().

◆ fetchAndAddAcquire()

int QAtomicInt::fetchAndAddAcquire ( int  valueToAdd)

Atomic fetch-and-add.

Reads the current value of this QAtomicInt and then adds valueToAdd to the current value, returning the original value.

This function uses acquire memory ordering semantics, which ensures that memory access following the atomic operation (in program order) may not be re-ordered before the atomic operation.

Referenced by QAudioRingBuffer::acquireReadRegion(), QAudioRingBuffer::acquireWriteRegion(), QAudioInputPrivate::inputCallback(), QFastMutex::lock(), QAudioOutputPrivate::renderCallback(), QNetworkAccessHttpBackend::replyDownloadData(), and QNetworkAccessHttpBackend::replyDownloadProgressSlot().

◆ fetchAndAddOrdered()

int QAtomicInt::fetchAndAddOrdered ( int  valueToAdd)

Atomic fetch-and-add.

Reads the current value of this QAtomicInt and then adds valueToAdd to the current value, returning the original value.

This function uses ordered memory ordering semantics, which ensures that memory access before and after the atomic operation (in program order) may not be re-ordered.

◆ fetchAndAddRelaxed()

int QAtomicInt::fetchAndAddRelaxed ( int  valueToAdd)

Atomic fetch-and-add.

Reads the current value of this QAtomicInt and then adds valueToAdd to the current value, returning the original value.

This function uses relaxed memory ordering semantics, leaving the compiler and processor to freely reorder memory accesses.

Referenced by QFutureWatcherBasePrivate::postCallOutEvent(), QFbWindow::QFbWindow(), QFutureWatcherBasePrivate::sendCallOutEvent(), and QSvgIconEnginePrivate::stepSerialNum().

◆ fetchAndAddRelease()

int QAtomicInt::fetchAndAddRelease ( int  valueToAdd)

Atomic fetch-and-add.

Reads the current value of this QAtomicInt and then adds valueToAdd to the current value, returning the original value.

This function uses release memory ordering semantics, which ensures that memory access before the atomic operation (in program order) may not be re-ordered after the atomic operation.

Referenced by QHttpThreadDelegate::dataReadProgressSlot(), QHttpThreadDelegate::finishedSlot(), QHttpThreadDelegate::readyReadSlot(), QAudioRingBuffer::releaseReadRegion(), and QAudioRingBuffer::releaseWriteRegion().

◆ fetchAndStoreAcquire()

int QAtomicInt::fetchAndStoreAcquire ( int  newValue)

Atomic fetch-and-store.

Reads the current value of this QAtomicInt and then assigns it the newValue, returning the original value.

This function uses acquire memory ordering semantics, which ensures that memory access following the atomic operation (in program order) may not be re-ordered before the atomic operation.

Referenced by QMutexPrivate::wait().

◆ fetchAndStoreOrdered()

int QAtomicInt::fetchAndStoreOrdered ( int  newValue)

Atomic fetch-and-store.

Reads the current value of this QAtomicInt and then assigns it the newValue, returning the original value.

This function uses ordered memory ordering semantics, which ensures that memory access before and after the atomic operation (in program order) may not be re-ordered.

◆ fetchAndStoreRelaxed()

int QAtomicInt::fetchAndStoreRelaxed ( int  newValue)

Atomic fetch-and-store.

Reads the current value of this QAtomicInt and then assigns it the newValue, returning the original value.

This function uses relaxed memory ordering semantics, leaving the compiler and processor to freely reorder memory accesses.

Referenced by QEventDispatcherBlackberryPrivate::processThreadWakeUp(), and QDBusUnixFileDescriptor::takeFileDescriptor().

◆ fetchAndStoreRelease()

int QAtomicInt::fetchAndStoreRelease ( int  newValue)

Atomic fetch-and-store.

Reads the current value of this QAtomicInt and then assigns it the newValue, returning the original value.

This function uses release memory ordering semantics, which ensures that memory access before the atomic operation (in program order) may not be re-ordered after the atomic operation.

◆ isFetchAndAddNative()

bool QAtomicInt::isFetchAndAddNative ( )
static

Returns true if fetch-and-add is implemented using atomic processor instructions, false otherwise.

◆ isFetchAndAddWaitFree()

bool QAtomicInt::isFetchAndAddWaitFree ( )
static

Returns true if atomic fetch-and-add is wait-free, false otherwise.

◆ isFetchAndStoreNative()

bool QAtomicInt::isFetchAndStoreNative ( )
static

Returns true if fetch-and-store is implemented using atomic processor instructions, false otherwise.

◆ isFetchAndStoreWaitFree()

bool QAtomicInt::isFetchAndStoreWaitFree ( )
static

Returns true if atomic fetch-and-store is wait-free, false otherwise.

◆ isReferenceCountingNative()

bool QAtomicInt::isReferenceCountingNative ( )
static

Returns true if reference counting is implemented using atomic processor instructions, false otherwise.

◆ isReferenceCountingWaitFree()

bool QAtomicInt::isReferenceCountingWaitFree ( )
static

Returns true if atomic reference counting is wait-free, false otherwise.

◆ isTestAndSetNative()

bool QAtomicInt::isTestAndSetNative ( )
static

Returns true if test-and-set is implemented using atomic processor instructions, false otherwise.

◆ isTestAndSetWaitFree()

bool QAtomicInt::isTestAndSetWaitFree ( )
static

Returns true if atomic test-and-set is wait-free, false otherwise.

◆ operator int()

QAtomicInt::operator int ( ) const

Returns the value stored by the QAtomicInt object as an integer.

◆ operator!()

bool QAtomicInt::operator! ( ) const

Returns true is the value of this QAtomicInt is zero; otherwise returns false.

◆ operator!=()

bool QAtomicInt::operator!= ( int  value) const

Returns true if the value of this QAtomicInt is not equal to value; otherwise returns false.

◆ operator=() [1/2]

QAtomicInt & QAtomicInt::operator= ( int  value)
inline

Assigns the value to this QAtomicInt and returns a reference to this QAtomicInt.

Definition at line 73 of file qatomic.h.

74  {
75  (void) QBasicAtomicInt::operator=(value);
76  return *this;
77  }

◆ operator=() [2/2]

QAtomicInt & QAtomicInt::operator= ( const QAtomicInt other)
inline

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

Definition at line 79 of file qatomic.h.

80  {
81  (void) QBasicAtomicInt::operator=(other);
82  return *this;
83  }

◆ operator==()

bool QAtomicInt::operator== ( int  value) const

Returns true if the value is equal to the value in this QAtomicInt; otherwise returns false.

◆ ref()

bool QAtomicInt::ref ( )

Atomically increments the value of this QAtomicInt.

Returns true if the new value is non-zero, false otherwise.

This function uses ordered memory ordering semantics, which ensures that memory access before and after the atomic operation (in program order) may not be re-ordered.

See also
deref()

Referenced by QDeclarativeListModelWorkerAgent::addref(), QDBusMarshaller::appendRegisteredType(), QImageData::create(), QPatternist::XsdSchemaParserContext::createAnonymousName(), QIcon::detach(), QDeclarativeXmlQueryEngine::doQuery(), QFontDatabase::findFont(), QTextEngine::fontEngine(), QFontEngineMacMulti::fontIndexForFontID(), QRawFont::fromFont(), QConfFile::fromName(), QPatternist::Item::fromPublic(), getEngineData(), QFreetypeFace::getFace(), QTextLine::glyphs(), QFontEngineFT::initFromFontEngine(), QDomNodePrivate::insertAfter(), QDomNodePrivate::insertBefore(), QLibraryPrivate::load(), QFontDatabase::load(), QResourcePrivate::load(), QFontEngineMultiXLFD::loadEngine(), QFontEngineMultiFT::loadEngine(), QLibraryPrivate::loadPlugin(), loadWin(), QFontDatabase::loadXlfd(), QTextDocumentFragment::operator=(), QSupportedWritingSystems::operator=(), QGLBuffer::operator=(), QIcon::operator=(), QRegExp::operator=(), QPalette::operator=(), QBrush::operator=(), QUrl::operator=(), QPlatformWindowFormat::operator=(), QPaintBuffer::operator=(), QPainterPath::operator=(), QCursor::operator=(), QDomImplementation::operator=(), QPersistentModelIndex::operator=(), QFutureInterfaceBase::operator=(), QDBusConnection::operator=(), QImage::operator=(), QGLFramebufferObjectFormat::operator=(), QDomNode::operator=(), QGLFormat::operator=(), QPatternist::Item::operator=(), QDomNodeList::operator=(), QDomNamedNodeMap::operator=(), QXmlItem::operator=(), QTouchEvent::TouchPoint::operator=(), QNetworkProxyPrivate::operator==(), QRawFontPrivate::platformLoadFromData(), prepareEngine_helper(), QPainterReplayer::process(), Q_GLOBAL_STATIC_WITH_ARGS(), QBrush::QBrush(), QColormap::QColormap(), QCursor::QCursor(), QDBusArgument::QDBusArgument(), QDBusMessage::QDBusMessage(), QDomElementPrivate::QDomElementPrivate(), QDomNodeListPrivate::QDomNodeListPrivate(), QFontEngineMacMulti::QFontEngineMacMulti(), QFontEngineMultiFT::QFontEngineMultiFT(), QFontEngineMultiQPA::QFontEngineMultiQPA(), QFontEngineMultiQWS::QFontEngineMultiQWS(), QFontEngineMultiWin::QFontEngineMultiWin(), QFontPrivate::QFontPrivate(), QFontSubset::QFontSubset(), QFutureInterfaceBase::QFutureInterfaceBase(), QGLBuffer::QGLBuffer(), QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(), QIcon::QIcon(), QImage::QImage(), QKeySequence::QKeySequence(), QPaintBuffer::QPaintBuffer(), QPainterPath::QPainterPath(), QPalette::QPalette(), QPersistentModelIndex::QPersistentModelIndex(), qRegisterResourceData(), QTextDocumentFragment::QTextDocumentFragment(), QTextItemIntCopy::QTextItemIntCopy(), QUrl::QUrl(), QXmlItem::QXmlItem(), registerFont(), QResource::registerResource(), releaseFontData(), QDomNodePrivate::replaceChild(), QCursorData::setBitmap(), QStaticTextItem::setFontEngine(), QX11PixmapData::setMask(), QDomNamedNodeMapPrivate::setNamedItem(), QDomNamedNodeMapPrivate::setNamedItemNS(), QRawFont::setPixelSize(), QCursor::setShape(), QStaticTextItem::setUserData(), QFontPrivate::smallCapsFontPrivate(), and QTouchEvent::TouchPoint::TouchPoint().

◆ testAndSetAcquire()

bool QAtomicInt::testAndSetAcquire ( int  expectedValue,
int  newValue 
)

Atomic test-and-set.

If the current value of this QAtomicInt is the expectedValue, the test-and-set functions assign the newValue to this QAtomicInt and return true. If the values are not the same, this function does nothing and returns false.

This function uses acquire memory ordering semantics, which ensures that memory access following the atomic operation (in program order) may not be re-ordered before the atomic operation.

Referenced by Rendezvous::checkpoint(), QMutex::lock(), QMutex::lockInternal(), QMutex::tryLock(), and QFastMutex::tryLock().

◆ testAndSetOrdered()

bool QAtomicInt::testAndSetOrdered ( int  expectedValue,
int  newValue 
)

Atomic test-and-set.

If the current value of this QAtomicInt is the expectedValue, the test-and-set functions assign the newValue to this QAtomicInt and return true. If the values are not the same, this function does nothing and returns false.

This function uses ordered memory ordering semantics, which ensures that memory access before and after the atomic operation (in program order) may not be re-ordered.

Referenced by Rendezvous::checkpoint().

◆ testAndSetRelaxed()

bool QAtomicInt::testAndSetRelaxed ( int  expectedValue,
int  newValue 
)

Atomic test-and-set.

If the current value of this QAtomicInt is the expectedValue, the test-and-set functions assign the newValue to this QAtomicInt and return true. If the values are not the same, this function does nothing and returns false.

This function uses relaxed memory ordering semantics, leaving the compiler and processor to freely reorder memory accesses.

◆ testAndSetRelease()

bool QAtomicInt::testAndSetRelease ( int  expectedValue,
int  newValue 
)

Atomic test-and-set.

If the current value of this QAtomicInt is the expectedValue, the test-and-set functions assign the newValue to this QAtomicInt and return true. If the values are not the same, this function does nothing and returns false.

This function uses release memory ordering semantics, which ensures that memory access before the atomic operation (in program order) may not be re-ordered after the atomic operation.

Referenced by QEventDispatcherUNIXPrivate::processThreadWakeUp(), QMutex::unlock(), and QFastMutex::unlock().


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