Port from QAtomic::load() to loadRelaxed()
Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
84e89c1e9e
commit
34fe9232db
@ -206,9 +206,9 @@ public:
|
||||
bool shouldStartThread() override
|
||||
{
|
||||
if (forIteration)
|
||||
return (currentIndex.load() < iterationCount) && !this->shouldThrottleThread();
|
||||
return (currentIndex.loadRelaxed() < iterationCount) && !this->shouldThrottleThread();
|
||||
else // whileIteration
|
||||
return (iteratorThreads.load() == 0);
|
||||
return (iteratorThreads.loadRelaxed() == 0);
|
||||
}
|
||||
|
||||
ThreadFunctionResult threadFunction() override
|
||||
@ -230,7 +230,7 @@ public:
|
||||
|
||||
const int currentBlockSize = blockSizeManager.blockSize();
|
||||
|
||||
if (currentIndex.load() >= iterationCount)
|
||||
if (currentIndex.loadRelaxed() >= iterationCount)
|
||||
break;
|
||||
|
||||
// Atomically reserve a block of iterationCount for this thread.
|
||||
@ -261,7 +261,7 @@ public:
|
||||
// Report progress if progress reporting enabled.
|
||||
if (progressReportingEnabled) {
|
||||
completed.fetchAndAddAcquire(finalBlockSize);
|
||||
this->setProgressValue(this->completed.load());
|
||||
this->setProgressValue(this->completed.loadRelaxed());
|
||||
}
|
||||
|
||||
if (this->shouldThrottleThread())
|
||||
|
@ -91,7 +91,7 @@ ThreadEngineBarrier::ThreadEngineBarrier()
|
||||
void ThreadEngineBarrier::acquire()
|
||||
{
|
||||
forever {
|
||||
int localCount = count.load();
|
||||
int localCount = count.loadRelaxed();
|
||||
if (localCount < 0) {
|
||||
if (count.testAndSetOrdered(localCount, localCount -1))
|
||||
return;
|
||||
@ -105,7 +105,7 @@ void ThreadEngineBarrier::acquire()
|
||||
int ThreadEngineBarrier::release()
|
||||
{
|
||||
forever {
|
||||
int localCount = count.load();
|
||||
int localCount = count.loadRelaxed();
|
||||
if (localCount == -1) {
|
||||
if (count.testAndSetOrdered(-1, 0)) {
|
||||
semaphore.release();
|
||||
@ -125,7 +125,7 @@ int ThreadEngineBarrier::release()
|
||||
void ThreadEngineBarrier::wait()
|
||||
{
|
||||
forever {
|
||||
int localCount = count.load();
|
||||
int localCount = count.loadRelaxed();
|
||||
if (localCount == 0)
|
||||
return;
|
||||
|
||||
@ -139,7 +139,7 @@ void ThreadEngineBarrier::wait()
|
||||
|
||||
int ThreadEngineBarrier::currentCount()
|
||||
{
|
||||
return count.load();
|
||||
return count.loadRelaxed();
|
||||
}
|
||||
|
||||
// releases a thread, unless this is the last thread.
|
||||
@ -147,7 +147,7 @@ int ThreadEngineBarrier::currentCount()
|
||||
bool ThreadEngineBarrier::releaseUnlessLast()
|
||||
{
|
||||
forever {
|
||||
int localCount = count.load();
|
||||
int localCount = count.loadRelaxed();
|
||||
if (qAbs(localCount) == 1) {
|
||||
return false;
|
||||
} else if (localCount < 0) {
|
||||
|
@ -283,11 +283,11 @@ void QVariantAnimationPrivate::setCurrentValueForProgress(const qreal progress)
|
||||
qSwap(currentValue, ret);
|
||||
q->updateCurrentValue(currentValue);
|
||||
static QBasicAtomicInt changedSignalIndex = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
if (!changedSignalIndex.load()) {
|
||||
if (!changedSignalIndex.loadRelaxed()) {
|
||||
//we keep the mask so that we emit valueChanged only when needed (for performance reasons)
|
||||
changedSignalIndex.testAndSetRelaxed(0, signalIndex("valueChanged(QVariant)"));
|
||||
}
|
||||
if (isSignalConnected(changedSignalIndex.load()) && currentValue != ret) {
|
||||
if (isSignalConnected(changedSignalIndex.loadRelaxed()) && currentValue != ret) {
|
||||
//the value has changed
|
||||
emit q->valueChanged(currentValue);
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ QSimpleTextCodec::QSimpleTextCodec(int i) : forwardIndex(i), reverseMap(0)
|
||||
|
||||
QSimpleTextCodec::~QSimpleTextCodec()
|
||||
{
|
||||
delete reverseMap.load();
|
||||
delete reverseMap.loadRelaxed();
|
||||
}
|
||||
|
||||
static QByteArray *buildReverseMap(int forwardIndex)
|
||||
@ -662,12 +662,12 @@ QByteArray QSimpleTextCodec::convertFromUnicode(const QChar *in, int length, Con
|
||||
const char replacement = (state && state->flags & ConvertInvalidToNull) ? 0 : '?';
|
||||
int invalid = 0;
|
||||
|
||||
QByteArray *rmap = reverseMap.load();
|
||||
QByteArray *rmap = reverseMap.loadRelaxed();
|
||||
if (!rmap){
|
||||
rmap = buildReverseMap(this->forwardIndex);
|
||||
if (!reverseMap.testAndSetRelease(0, rmap)) {
|
||||
delete rmap;
|
||||
rmap = reverseMap.load();
|
||||
rmap = reverseMap.loadRelaxed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,15 +80,15 @@ enum GuardValues {
|
||||
{ \
|
||||
struct HolderBase { \
|
||||
~HolderBase() noexcept \
|
||||
{ if (guard.load() == QtGlobalStatic::Initialized) \
|
||||
guard.store(QtGlobalStatic::Destroyed); } \
|
||||
{ if (guard.loadRelaxed() == QtGlobalStatic::Initialized) \
|
||||
guard.storeRelaxed(QtGlobalStatic::Destroyed); } \
|
||||
}; \
|
||||
static struct Holder : public HolderBase { \
|
||||
Type value; \
|
||||
Holder() \
|
||||
noexcept(noexcept(Type ARGS)) \
|
||||
: value ARGS \
|
||||
{ guard.store(QtGlobalStatic::Initialized); } \
|
||||
{ guard.storeRelaxed(QtGlobalStatic::Initialized); } \
|
||||
} holder; \
|
||||
return &holder.value; \
|
||||
}
|
||||
@ -108,12 +108,12 @@ QT_BEGIN_NAMESPACE
|
||||
int x = guard.loadAcquire(); \
|
||||
if (Q_UNLIKELY(x >= QtGlobalStatic::Uninitialized)) { \
|
||||
QMutexLocker locker(&mutex); \
|
||||
if (guard.load() == QtGlobalStatic::Uninitialized) { \
|
||||
if (guard.loadRelaxed() == QtGlobalStatic::Uninitialized) { \
|
||||
d = new Type ARGS; \
|
||||
static struct Cleanup { \
|
||||
~Cleanup() { \
|
||||
delete d; \
|
||||
guard.store(QtGlobalStatic::Destroyed); \
|
||||
guard.storeRelaxed(QtGlobalStatic::Destroyed); \
|
||||
} \
|
||||
} cleanup; \
|
||||
guard.storeRelease(QtGlobalStatic::Initialized); \
|
||||
@ -129,8 +129,8 @@ struct QGlobalStatic
|
||||
{
|
||||
typedef T Type;
|
||||
|
||||
bool isDestroyed() const { return guard.load() <= QtGlobalStatic::Destroyed; }
|
||||
bool exists() const { return guard.load() == QtGlobalStatic::Initialized; }
|
||||
bool isDestroyed() const { return guard.loadRelaxed() <= QtGlobalStatic::Destroyed; }
|
||||
bool exists() const { return guard.loadRelaxed() == QtGlobalStatic::Initialized; }
|
||||
operator Type *() { if (isDestroyed()) return nullptr; return innerFunction(); }
|
||||
Type *operator()() { if (isDestroyed()) return nullptr; return innerFunction(); }
|
||||
Type *operator->()
|
||||
|
@ -197,7 +197,7 @@ static bool isFatal(QtMsgType msgType)
|
||||
|
||||
// it's fatal if the current value is exactly 1,
|
||||
// otherwise decrement if it's non-zero
|
||||
return fatalCriticals.load() && fatalCriticals.fetchAndAddRelaxed(-1) == 1;
|
||||
return fatalCriticals.loadRelaxed() && fatalCriticals.fetchAndAddRelaxed(-1) == 1;
|
||||
}
|
||||
|
||||
if (msgType == QtWarningMsg || msgType == QtCriticalMsg) {
|
||||
@ -205,7 +205,7 @@ static bool isFatal(QtMsgType msgType)
|
||||
|
||||
// it's fatal if the current value is exactly 1,
|
||||
// otherwise decrement if it's non-zero
|
||||
return fatalWarnings.load() && fatalWarnings.fetchAndAddRelaxed(-1) == 1;
|
||||
return fatalWarnings.loadRelaxed() && fatalWarnings.fetchAndAddRelaxed(-1) == 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1814,11 +1814,11 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex
|
||||
// itself, e.g. by using Qt API
|
||||
if (grabMessageHandler()) {
|
||||
// prefer new message handler over the old one
|
||||
if (msgHandler.load() == qDefaultMsgHandler
|
||||
|| messageHandler.load() != qDefaultMessageHandler) {
|
||||
(*messageHandler.load())(msgType, context, message);
|
||||
if (msgHandler.loadRelaxed() == qDefaultMsgHandler
|
||||
|| messageHandler.loadRelaxed() != qDefaultMessageHandler) {
|
||||
(*messageHandler.loadRelaxed())(msgType, context, message);
|
||||
} else {
|
||||
(*msgHandler.load())(msgType, message.toLocal8Bit().constData());
|
||||
(*msgHandler.loadRelaxed())(msgType, message.toLocal8Bit().constData());
|
||||
}
|
||||
ungrabMessageHandler();
|
||||
} else {
|
||||
|
@ -186,7 +186,7 @@ struct QRandomGenerator::SystemGenerator
|
||||
#endif
|
||||
static void closeDevice()
|
||||
{
|
||||
int fd = self().fdp1.load() - 1;
|
||||
int fd = self().fdp1.loadRelaxed() - 1;
|
||||
if (fd >= 0)
|
||||
qt_safe_close(fd);
|
||||
}
|
||||
@ -310,7 +310,7 @@ static void fallback_fill(quint32 *ptr, qsizetype left) noexcept
|
||||
*end++ = quint32(nsecs); // 5
|
||||
#endif
|
||||
|
||||
if (quint32 v = seed.load())
|
||||
if (quint32 v = seed.loadRelaxed())
|
||||
*end++ = v; // 6
|
||||
|
||||
#if QT_CONFIG(getauxval)
|
||||
|
@ -239,7 +239,7 @@ QLoggingCategory::QLoggingCategory(const char *category, QtMsgType enableForLeve
|
||||
|
||||
void QLoggingCategory::init(const char *category, QtMsgType severityLevel)
|
||||
{
|
||||
enabled.store(0x01010101); // enabledDebug = enabledWarning = enabledCritical = true;
|
||||
enabled.storeRelaxed(0x01010101); // enabledDebug = enabledWarning = enabledCritical = true;
|
||||
|
||||
if (category)
|
||||
name = category;
|
||||
@ -342,10 +342,10 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
|
||||
{
|
||||
switch (type) {
|
||||
#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
|
||||
case QtDebugMsg: bools.enabledDebug.store(enable); break;
|
||||
case QtInfoMsg: bools.enabledInfo.store(enable); break;
|
||||
case QtWarningMsg: bools.enabledWarning.store(enable); break;
|
||||
case QtCriticalMsg: bools.enabledCritical.store(enable); break;
|
||||
case QtDebugMsg: bools.enabledDebug.storeRelaxed(enable); break;
|
||||
case QtInfoMsg: bools.enabledInfo.storeRelaxed(enable); break;
|
||||
case QtWarningMsg: bools.enabledWarning.storeRelaxed(enable); break;
|
||||
case QtCriticalMsg: bools.enabledCritical.storeRelaxed(enable); break;
|
||||
#else
|
||||
case QtDebugMsg: setBoolLane(&enabled, enable, DebugShift); break;
|
||||
case QtInfoMsg: setBoolLane(&enabled, enable, InfoShift); break;
|
||||
|
@ -58,15 +58,15 @@ public:
|
||||
void setEnabled(QtMsgType type, bool enable);
|
||||
|
||||
#ifdef Q_ATOMIC_INT8_IS_SUPPORTED
|
||||
bool isDebugEnabled() const { return bools.enabledDebug.load(); }
|
||||
bool isInfoEnabled() const { return bools.enabledInfo.load(); }
|
||||
bool isWarningEnabled() const { return bools.enabledWarning.load(); }
|
||||
bool isCriticalEnabled() const { return bools.enabledCritical.load(); }
|
||||
bool isDebugEnabled() const { return bools.enabledDebug.loadRelaxed(); }
|
||||
bool isInfoEnabled() const { return bools.enabledInfo.loadRelaxed(); }
|
||||
bool isWarningEnabled() const { return bools.enabledWarning.loadRelaxed(); }
|
||||
bool isCriticalEnabled() const { return bools.enabledCritical.loadRelaxed(); }
|
||||
#else
|
||||
bool isDebugEnabled() const { return enabled.load() >> DebugShift & 1; }
|
||||
bool isInfoEnabled() const { return enabled.load() >> InfoShift & 1; }
|
||||
bool isWarningEnabled() const { return enabled.load() >> WarningShift & 1; }
|
||||
bool isCriticalEnabled() const { return enabled.load() >> CriticalShift & 1; }
|
||||
bool isDebugEnabled() const { return enabled.loadRelaxed() >> DebugShift & 1; }
|
||||
bool isInfoEnabled() const { return enabled.loadRelaxed() >> InfoShift & 1; }
|
||||
bool isWarningEnabled() const { return enabled.loadRelaxed() >> WarningShift & 1; }
|
||||
bool isCriticalEnabled() const { return enabled.loadRelaxed() >> CriticalShift & 1; }
|
||||
#endif
|
||||
const char *categoryName() const { return name; }
|
||||
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
|
||||
template<> Q_INLINE_TEMPLATE void QSharedDataPointer<QProcessEnvironmentPrivate>::detach()
|
||||
{
|
||||
if (d && d->ref.load() == 1)
|
||||
if (d && d->ref.loadRelaxed() == 1)
|
||||
return;
|
||||
QProcessEnvironmentPrivate *x = (d ? new QProcessEnvironmentPrivate(*d)
|
||||
: new QProcessEnvironmentPrivate);
|
||||
|
@ -3802,7 +3802,7 @@ void QUrl::detach()
|
||||
*/
|
||||
bool QUrl::isDetached() const
|
||||
{
|
||||
return !d || d->ref.load() == 1;
|
||||
return !d || d->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,7 +189,7 @@ public:
|
||||
|
||||
template<> void QSharedDataPointer<QUrlQueryPrivate>::detach()
|
||||
{
|
||||
if (d && d->ref.load() == 1)
|
||||
if (d && d->ref.loadRelaxed() == 1)
|
||||
return;
|
||||
QUrlQueryPrivate *x = (d ? new QUrlQueryPrivate(*d)
|
||||
: new QUrlQueryPrivate);
|
||||
@ -462,7 +462,7 @@ bool QUrlQuery::isEmpty() const
|
||||
*/
|
||||
bool QUrlQuery::isDetached() const
|
||||
{
|
||||
return d && d->ref.load() == 1;
|
||||
return d && d->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -77,7 +77,7 @@ QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &
|
||||
void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)
|
||||
{
|
||||
Q_ASSERT(data);
|
||||
Q_ASSERT(data->ref.load() == 0);
|
||||
Q_ASSERT(data->ref.loadRelaxed() == 0);
|
||||
QAbstractItemModel *model = const_cast<QAbstractItemModel *>(data->index.model());
|
||||
// a valid persistent model index with a null model pointer can only happen if the model was destroyed
|
||||
if (model) {
|
||||
|
@ -170,7 +170,7 @@ QAbstractEventDispatcher::~QAbstractEventDispatcher()
|
||||
QAbstractEventDispatcher *QAbstractEventDispatcher::instance(QThread *thread)
|
||||
{
|
||||
QThreadData *data = thread ? QThreadData::get2(thread) : QThreadData::current();
|
||||
return data->eventDispatcher.load();
|
||||
return data->eventDispatcher.loadRelaxed();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -164,7 +164,7 @@ inline void qt_ignore_sigpipe()
|
||||
{
|
||||
// Set to ignore SIGPIPE once only.
|
||||
static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
if (!atom.load()) {
|
||||
if (!atom.loadRelaxed()) {
|
||||
// More than one thread could turn off SIGPIPE at the same time
|
||||
// But that's acceptable because they all would be doing the same
|
||||
// action
|
||||
@ -172,7 +172,7 @@ inline void qt_ignore_sigpipe()
|
||||
memset(&noaction, 0, sizeof(noaction));
|
||||
noaction.sa_handler = SIG_IGN;
|
||||
::sigaction(SIGPIPE, &noaction, nullptr);
|
||||
atom.store(1);
|
||||
atom.storeRelaxed(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,8 +552,8 @@ void QCoreApplicationPrivate::eventDispatcherReady()
|
||||
QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
QThread *QCoreApplicationPrivate::mainThread()
|
||||
{
|
||||
Q_ASSERT(theMainThread.load() != 0);
|
||||
return theMainThread.load();
|
||||
Q_ASSERT(theMainThread.loadRelaxed() != 0);
|
||||
return theMainThread.loadRelaxed();
|
||||
}
|
||||
|
||||
bool QCoreApplicationPrivate::threadRequiresCoreApplication()
|
||||
@ -854,7 +854,7 @@ void QCoreApplicationPrivate::init()
|
||||
#ifndef QT_NO_QOBJECT
|
||||
// use the event dispatcher created by the app programmer (if any)
|
||||
Q_ASSERT(!eventDispatcher);
|
||||
eventDispatcher = threadData->eventDispatcher.load();
|
||||
eventDispatcher = threadData->eventDispatcher.loadRelaxed();
|
||||
|
||||
// otherwise we create one
|
||||
if (!eventDispatcher)
|
||||
@ -1302,7 +1302,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
QThreadData *data = QThreadData::current();
|
||||
if (!data->hasEventDispatcher())
|
||||
return;
|
||||
data->eventDispatcher.load()->processEvents(flags);
|
||||
data->eventDispatcher.loadRelaxed()->processEvents(flags);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1334,7 +1334,7 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m
|
||||
return;
|
||||
QElapsedTimer start;
|
||||
start.start();
|
||||
while (data->eventDispatcher.load()->processEvents(flags & ~QEventLoop::WaitForMoreEvents)) {
|
||||
while (data->eventDispatcher.loadRelaxed()->processEvents(flags & ~QEventLoop::WaitForMoreEvents)) {
|
||||
if (start.elapsed() > ms)
|
||||
break;
|
||||
}
|
||||
@ -1738,7 +1738,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
|
||||
|
||||
--data->postEventList.recursion;
|
||||
if (!data->postEventList.recursion && !data->canWait && data->hasEventDispatcher())
|
||||
data->eventDispatcher.load()->wakeUp();
|
||||
data->eventDispatcher.loadRelaxed()->wakeUp();
|
||||
|
||||
// clear the global list, i.e. remove everything that was
|
||||
// delivered.
|
||||
@ -1989,7 +1989,7 @@ void QCoreApplicationPrivate::deref()
|
||||
|
||||
void QCoreApplicationPrivate::maybeQuit()
|
||||
{
|
||||
if (quitLockRef.load() == 0 && in_exec && quitLockRefEnabled && shouldQuit())
|
||||
if (quitLockRef.loadRelaxed() == 0 && in_exec && quitLockRefEnabled && shouldQuit())
|
||||
QCoreApplication::postEvent(QCoreApplication::instance(), new QEvent(QEvent::Quit));
|
||||
}
|
||||
|
||||
@ -2958,7 +2958,7 @@ bool QCoreApplication::hasPendingEvents()
|
||||
QAbstractEventDispatcher *QCoreApplication::eventDispatcher()
|
||||
{
|
||||
if (QCoreApplicationPrivate::theMainThread)
|
||||
return QCoreApplicationPrivate::theMainThread.load()->eventDispatcher();
|
||||
return QCoreApplicationPrivate::theMainThread.loadRelaxed()->eventDispatcher();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -424,7 +424,7 @@ struct QBasicAtomicBitField {
|
||||
bool allocateSpecific(int which) noexcept
|
||||
{
|
||||
QBasicAtomicInteger<uint> &entry = data[which / BitsPerInt];
|
||||
const uint old = entry.load();
|
||||
const uint old = entry.loadRelaxed();
|
||||
const uint bit = 1U << (which % BitsPerInt);
|
||||
return !(old & bit) // wasn't taken
|
||||
&& entry.testAndSetRelaxed(old, old | bit); // still wasn't taken
|
||||
@ -445,10 +445,10 @@ struct QBasicAtomicBitField {
|
||||
|
||||
// Then again, this should never execute many iterations, so
|
||||
// leave like this for now:
|
||||
for (uint i = next.load(); i < NumBits; ++i) {
|
||||
for (uint i = next.loadRelaxed(); i < NumBits; ++i) {
|
||||
if (allocateSpecific(i)) {
|
||||
// remember next (possibly) free id:
|
||||
const uint oldNext = next.load();
|
||||
const uint oldNext = next.loadRelaxed();
|
||||
next.testAndSetRelaxed(oldNext, qMax(i + 1, oldNext));
|
||||
return i;
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static gboolean postEventSourcePrepare(GSource *s, gint *timeout)
|
||||
*timeout = canWait ? -1 : 0;
|
||||
|
||||
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
|
||||
source->d->wakeUpCalled = source->serialNumber.load() != source->lastSerialNumber;
|
||||
source->d->wakeUpCalled = source->serialNumber.loadRelaxed() != source->lastSerialNumber;
|
||||
return !canWait || source->d->wakeUpCalled;
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ static gboolean postEventSourceCheck(GSource *source)
|
||||
static gboolean postEventSourceDispatch(GSource *s, GSourceFunc, gpointer)
|
||||
{
|
||||
GPostEventSource *source = reinterpret_cast<GPostEventSource *>(s);
|
||||
source->lastSerialNumber = source->serialNumber.load();
|
||||
source->lastSerialNumber = source->serialNumber.loadRelaxed();
|
||||
QCoreApplication::sendPostedEvents();
|
||||
source->d->runTimersOnceWithNormalPriority();
|
||||
return true; // i dunno, george...
|
||||
@ -320,7 +320,7 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
|
||||
// setup post event source
|
||||
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
|
||||
sizeof(GPostEventSource)));
|
||||
postEventSource->serialNumber.store(1);
|
||||
postEventSource->serialNumber.storeRelaxed(1);
|
||||
postEventSource->d = this;
|
||||
g_source_set_can_recurse(&postEventSource->source, true);
|
||||
g_source_attach(&postEventSource->source, mainContext);
|
||||
|
@ -459,7 +459,7 @@ void QEventDispatcherUNIX::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
{
|
||||
Q_D(QEventDispatcherUNIX);
|
||||
d->interrupt.store(0);
|
||||
d->interrupt.storeRelaxed(0);
|
||||
|
||||
// we are awake, broadcast it
|
||||
emit awake();
|
||||
@ -470,13 +470,13 @@ bool QEventDispatcherUNIX::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
const bool wait_for_events = flags & QEventLoop::WaitForMoreEvents;
|
||||
|
||||
const bool canWait = (d->threadData->canWaitLocked()
|
||||
&& !d->interrupt.load()
|
||||
&& !d->interrupt.loadRelaxed()
|
||||
&& wait_for_events);
|
||||
|
||||
if (canWait)
|
||||
emit aboutToBlock();
|
||||
|
||||
if (d->interrupt.load())
|
||||
if (d->interrupt.loadRelaxed())
|
||||
return false;
|
||||
|
||||
timespec *tm = nullptr;
|
||||
@ -545,7 +545,7 @@ void QEventDispatcherUNIX::wakeUp()
|
||||
void QEventDispatcherUNIX::interrupt()
|
||||
{
|
||||
Q_D(QEventDispatcherUNIX);
|
||||
d->interrupt.store(1);
|
||||
d->interrupt.storeRelaxed(1);
|
||||
wakeUp();
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
||||
Q_ASSERT(d != 0);
|
||||
|
||||
// Allow posting WM_QT_SENDPOSTEDEVENTS message.
|
||||
d->wakeUps.store(0);
|
||||
d->wakeUps.storeRelaxed(0);
|
||||
|
||||
// We send posted events manually, if the window procedure was invoked
|
||||
// by the foreign event loop (e.g. from the native modal dialog).
|
||||
@ -526,7 +526,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
wakeUp(); // trigger a call to sendPostedEvents()
|
||||
}
|
||||
|
||||
d->interrupt.store(false);
|
||||
d->interrupt.storeRelaxed(false);
|
||||
emit awake();
|
||||
|
||||
// To prevent livelocks, send posted events once per iteration.
|
||||
@ -545,7 +545,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
pHandles = &d->winEventNotifierActivatedEvent;
|
||||
}
|
||||
QVarLengthArray<MSG> processedTimers;
|
||||
while (!d->interrupt.load()) {
|
||||
while (!d->interrupt.loadRelaxed()) {
|
||||
MSG msg;
|
||||
bool haveMessage;
|
||||
|
||||
@ -590,7 +590,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
|
||||
// Set result to 'true', if the message was sent by wakeUp().
|
||||
if (msg.wParam == WMWP_QT_FROMWAKEUP) {
|
||||
d->wakeUps.store(0);
|
||||
d->wakeUps.storeRelaxed(0);
|
||||
retVal = true;
|
||||
}
|
||||
needWM_QT_SENDPOSTEDEVENTS = true;
|
||||
@ -639,7 +639,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
|
||||
// still nothing - wait for message or signalled objects
|
||||
canWait = (!retVal
|
||||
&& !d->interrupt.load()
|
||||
&& !d->interrupt.loadRelaxed()
|
||||
&& (flags & QEventLoop::WaitForMoreEvents));
|
||||
if (canWait) {
|
||||
emit aboutToBlock();
|
||||
@ -949,7 +949,7 @@ void QEventDispatcherWin32::activateEventNotifiers()
|
||||
for (int i = 0; i < d->winEventNotifierList.count(); ++i) {
|
||||
QWinEventNotifier *notifier = d->winEventNotifierList.at(i);
|
||||
QWinEventNotifierPrivate *nd = QWinEventNotifierPrivate::get(notifier);
|
||||
if (nd->signaledCount.load() != 0) {
|
||||
if (nd->signaledCount.loadRelaxed() != 0) {
|
||||
--nd->signaledCount;
|
||||
nd->unregisterWaitObject();
|
||||
d->activateEventNotifier(notifier);
|
||||
@ -1014,7 +1014,7 @@ void QEventDispatcherWin32::wakeUp()
|
||||
void QEventDispatcherWin32::interrupt()
|
||||
{
|
||||
Q_D(QEventDispatcherWin32);
|
||||
d->interrupt.store(true);
|
||||
d->interrupt.storeRelaxed(true);
|
||||
wakeUp();
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ bool QEventLoop::processEvents(ProcessEventsFlags flags)
|
||||
Q_D(QEventLoop);
|
||||
if (!d->threadData->hasEventDispatcher())
|
||||
return false;
|
||||
return d->threadData->eventDispatcher.load()->processEvents(flags);
|
||||
return d->threadData->eventDispatcher.loadRelaxed()->processEvents(flags);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -225,7 +225,7 @@ int QEventLoop::exec(ProcessEventsFlags flags)
|
||||
processEvents(flags | WaitForMoreEvents | EventLoopExec);
|
||||
|
||||
ref.exceptionCaught = false;
|
||||
return d->returnCode.load();
|
||||
return d->returnCode.loadRelaxed();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -279,9 +279,9 @@ void QEventLoop::exit(int returnCode)
|
||||
if (!d->threadData->hasEventDispatcher())
|
||||
return;
|
||||
|
||||
d->returnCode.store(returnCode);
|
||||
d->returnCode.storeRelaxed(returnCode);
|
||||
d->exit.storeRelease(true);
|
||||
d->threadData->eventDispatcher.load()->interrupt();
|
||||
d->threadData->eventDispatcher.loadRelaxed()->interrupt();
|
||||
|
||||
#ifdef Q_OS_WASM
|
||||
// QEventLoop::exec() never returns in emscripten. We implement approximate behavior here.
|
||||
@ -318,7 +318,7 @@ void QEventLoop::wakeUp()
|
||||
Q_D(QEventLoop);
|
||||
if (!d->threadData->hasEventDispatcher())
|
||||
return;
|
||||
d->threadData->eventDispatcher.load()->wakeUp();
|
||||
d->threadData->eventDispatcher.loadRelaxed()->wakeUp();
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,8 +63,8 @@ public:
|
||||
inline QEventLoopPrivate()
|
||||
: inExec(false)
|
||||
{
|
||||
returnCode.store(-1);
|
||||
exit.store(true);
|
||||
returnCode.storeRelaxed(-1);
|
||||
exit.storeRelaxed(true);
|
||||
}
|
||||
|
||||
QAtomicInt quitLockRef;
|
||||
|
@ -1999,7 +1999,7 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
|
||||
static int qt_metatype_id() \
|
||||
{ \
|
||||
static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
|
||||
if (const int id = metatype_id.load()) \
|
||||
if (const int id = metatype_id.loadRelaxed()) \
|
||||
return id; \
|
||||
const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \
|
||||
Q_ASSERT(tName); \
|
||||
|
@ -222,7 +222,7 @@ QObjectPrivate::~QObjectPrivate()
|
||||
if (Q_LIKELY(threadData->thread == QThread::currentThread())) {
|
||||
// unregister pending timers
|
||||
if (threadData->hasEventDispatcher())
|
||||
threadData->eventDispatcher.load()->unregisterTimers(q_ptr);
|
||||
threadData->eventDispatcher.loadRelaxed()->unregisterTimers(q_ptr);
|
||||
|
||||
// release the timer ids back to the pool
|
||||
for (int i = 0; i < extraData->runningTimers.size(); ++i)
|
||||
@ -268,17 +268,17 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const
|
||||
{
|
||||
Q_Q(const QObject);
|
||||
int signal_index = signalIndex(signal);
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
if (signal_index < 0 || !cd)
|
||||
return false;
|
||||
QBasicMutexLocker locker(signalSlotLock(q));
|
||||
if (signal_index < cd->signalVectorCount()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.load()->at(signal_index).first.load();
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.loadRelaxed()->at(signal_index).first.loadRelaxed();
|
||||
|
||||
while (c) {
|
||||
if (c->receiver.load() == receiver)
|
||||
if (c->receiver.loadRelaxed() == receiver)
|
||||
return true;
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -289,17 +289,17 @@ QObjectList QObjectPrivate::receiverList(const char *signal) const
|
||||
{
|
||||
QObjectList returnValue;
|
||||
int signal_index = signalIndex(signal);
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
if (signal_index < 0 || !cd)
|
||||
return returnValue;
|
||||
if (signal_index < cd->signalVectorCount()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.load()->at(signal_index).first.load();
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.loadRelaxed()->at(signal_index).first.loadRelaxed();
|
||||
|
||||
while (c) {
|
||||
QObject *r = c->receiver.load();
|
||||
QObject *r = c->receiver.loadRelaxed();
|
||||
if (r)
|
||||
returnValue << r;
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
@ -309,7 +309,7 @@ QObjectList QObjectPrivate::receiverList(const char *signal) const
|
||||
QObjectList QObjectPrivate::senderList() const
|
||||
{
|
||||
QObjectList returnValue;
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
if (cd) {
|
||||
QBasicMutexLocker locker(signalSlotLock(q_func()));
|
||||
for (Connection *c = cd->senders; c; c = c->next)
|
||||
@ -332,24 +332,24 @@ void QObjectPrivate::addConnection(int signal, Connection *c)
|
||||
{
|
||||
Q_ASSERT(c->sender == q_ptr);
|
||||
ensureConnectionData();
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
cd->resizeSignalVector(signal + 1);
|
||||
|
||||
ConnectionList &connectionList = cd->connectionsForSignal(signal);
|
||||
if (connectionList.last.load()) {
|
||||
Q_ASSERT(connectionList.last.load()->receiver.load());
|
||||
connectionList.last.load()->nextConnectionList.store(c);
|
||||
if (connectionList.last.loadRelaxed()) {
|
||||
Q_ASSERT(connectionList.last.loadRelaxed()->receiver.loadRelaxed());
|
||||
connectionList.last.loadRelaxed()->nextConnectionList.storeRelaxed(c);
|
||||
} else {
|
||||
connectionList.first.store(c);
|
||||
connectionList.first.storeRelaxed(c);
|
||||
}
|
||||
c->id = ++cd->currentConnectionId;
|
||||
c->prevConnectionList = connectionList.last.load();
|
||||
connectionList.last.store(c);
|
||||
c->prevConnectionList = connectionList.last.loadRelaxed();
|
||||
connectionList.last.storeRelaxed(c);
|
||||
|
||||
QObjectPrivate *rd = QObjectPrivate::get(c->receiver.load());
|
||||
QObjectPrivate *rd = QObjectPrivate::get(c->receiver.loadRelaxed());
|
||||
rd->ensureConnectionData();
|
||||
|
||||
c->prev = &(rd->connections.load()->senders);
|
||||
c->prev = &(rd->connections.loadRelaxed()->senders);
|
||||
c->next = *c->prev;
|
||||
*c->prev = c;
|
||||
if (c->next)
|
||||
@ -358,17 +358,17 @@ void QObjectPrivate::addConnection(int signal, Connection *c)
|
||||
|
||||
void QObjectPrivate::ConnectionData::removeConnection(QObjectPrivate::Connection *c)
|
||||
{
|
||||
Q_ASSERT(c->receiver.load());
|
||||
ConnectionList &connections = signalVector.load()->at(c->signal_index);
|
||||
c->receiver.store(nullptr);
|
||||
QThreadData *td = c->receiverThreadData.load();
|
||||
Q_ASSERT(c->receiver.loadRelaxed());
|
||||
ConnectionList &connections = signalVector.loadRelaxed()->at(c->signal_index);
|
||||
c->receiver.storeRelaxed(nullptr);
|
||||
QThreadData *td = c->receiverThreadData.loadRelaxed();
|
||||
if (td)
|
||||
td->deref();
|
||||
c->receiverThreadData.store(nullptr);
|
||||
c->receiverThreadData.storeRelaxed(nullptr);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
bool found = false;
|
||||
for (Connection *cc = connections.first.load(); cc; cc = cc->nextConnectionList.load()) {
|
||||
for (Connection *cc = connections.first.loadRelaxed(); cc; cc = cc->nextConnectionList.loadRelaxed()) {
|
||||
if (cc == c) {
|
||||
found = true;
|
||||
break;
|
||||
@ -383,29 +383,29 @@ void QObjectPrivate::ConnectionData::removeConnection(QObjectPrivate::Connection
|
||||
c->next->prev = c->prev;
|
||||
c->prev = nullptr;
|
||||
|
||||
if (connections.first.load() == c)
|
||||
connections.first.store(c->nextConnectionList.load());
|
||||
if (connections.last.load() == c)
|
||||
connections.last.store(c->prevConnectionList);
|
||||
Q_ASSERT(signalVector.load()->at(c->signal_index).first.load() != c);
|
||||
Q_ASSERT(signalVector.load()->at(c->signal_index).last.load() != c);
|
||||
if (connections.first.loadRelaxed() == c)
|
||||
connections.first.storeRelaxed(c->nextConnectionList.loadRelaxed());
|
||||
if (connections.last.loadRelaxed() == c)
|
||||
connections.last.storeRelaxed(c->prevConnectionList);
|
||||
Q_ASSERT(signalVector.loadRelaxed()->at(c->signal_index).first.loadRelaxed() != c);
|
||||
Q_ASSERT(signalVector.loadRelaxed()->at(c->signal_index).last.loadRelaxed() != c);
|
||||
|
||||
// keep c->nextConnectionList intact, as it might still get accessed by activate
|
||||
Connection *n = c->nextConnectionList.load();
|
||||
Connection *n = c->nextConnectionList.loadRelaxed();
|
||||
if (n)
|
||||
n->prevConnectionList = c->prevConnectionList;
|
||||
if (c->prevConnectionList)
|
||||
c->prevConnectionList->nextConnectionList.store(n);
|
||||
c->prevConnectionList->nextConnectionList.storeRelaxed(n);
|
||||
c->prevConnectionList = nullptr;
|
||||
|
||||
Q_ASSERT(c != orphaned.load());
|
||||
Q_ASSERT(c != orphaned.loadRelaxed());
|
||||
// add c to orphanedConnections
|
||||
c->nextInOrphanList = orphaned.load();
|
||||
orphaned.store(c);
|
||||
c->nextInOrphanList = orphaned.loadRelaxed();
|
||||
orphaned.storeRelaxed(c);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
found = false;
|
||||
for (Connection *cc = connections.first.load(); cc; cc = cc->nextConnectionList.load()) {
|
||||
for (Connection *cc = connections.first.loadRelaxed(); cc; cc = cc->nextConnectionList.loadRelaxed()) {
|
||||
if (cc == c) {
|
||||
found = true;
|
||||
break;
|
||||
@ -427,8 +427,8 @@ void QObjectPrivate::ConnectionData::cleanOrphanedConnectionsImpl(QObject *sende
|
||||
// Since ref == 1, no activate() is in process since we locked the mutex. That implies,
|
||||
// that nothing can reference the orphaned connection objects anymore and they can
|
||||
// be safely deleted
|
||||
c = orphaned.load();
|
||||
orphaned.store(nullptr);
|
||||
c = orphaned.loadRelaxed();
|
||||
orphaned.storeRelaxed(nullptr);
|
||||
}
|
||||
deleteOrphaned(c);
|
||||
}
|
||||
@ -443,7 +443,7 @@ void QObjectPrivate::ConnectionData::deleteOrphaned(QObjectPrivate::ConnectionOr
|
||||
} else {
|
||||
QObjectPrivate::Connection *c = static_cast<Connection *>(o);
|
||||
next = c->nextInOrphanList;
|
||||
Q_ASSERT(!c->receiver.load());
|
||||
Q_ASSERT(!c->receiver.loadRelaxed());
|
||||
Q_ASSERT(!c->prev);
|
||||
c->freeSlotObject();
|
||||
c->deref();
|
||||
@ -463,22 +463,22 @@ bool QObjectPrivate::isSignalConnected(uint signalIndex, bool checkDeclarative)
|
||||
if (checkDeclarative && isDeclarativeSignalConnected(signalIndex))
|
||||
return true;
|
||||
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
if (!cd)
|
||||
return false;
|
||||
SignalVector *signalVector = cd->signalVector.load();
|
||||
SignalVector *signalVector = cd->signalVector.loadRelaxed();
|
||||
if (!signalVector)
|
||||
return false;
|
||||
|
||||
if (signalVector->at(-1).first.load())
|
||||
if (signalVector->at(-1).first.loadRelaxed())
|
||||
return true;
|
||||
|
||||
if (signalIndex < uint(cd->signalVectorCount())) {
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signalIndex).first.load();
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signalIndex).first.loadRelaxed();
|
||||
while (c) {
|
||||
if (c->receiver.load())
|
||||
if (c->receiver.loadRelaxed())
|
||||
return true;
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -486,10 +486,10 @@ bool QObjectPrivate::isSignalConnected(uint signalIndex, bool checkDeclarative)
|
||||
|
||||
bool QObjectPrivate::maybeSignalConnected(uint signalIndex) const
|
||||
{
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
if (!cd)
|
||||
return false;
|
||||
SignalVector *signalVector = cd->signalVector.load();
|
||||
SignalVector *signalVector = cd->signalVector.loadRelaxed();
|
||||
if (!signalVector)
|
||||
return false;
|
||||
|
||||
@ -944,15 +944,15 @@ QObject::~QObject()
|
||||
d->wasDeleted = true;
|
||||
d->blockSig = 0; // unblock signals so we always emit destroyed()
|
||||
|
||||
QtSharedPointer::ExternalRefCountData *sharedRefcount = d->sharedRefcount.load();
|
||||
QtSharedPointer::ExternalRefCountData *sharedRefcount = d->sharedRefcount.loadRelaxed();
|
||||
if (sharedRefcount) {
|
||||
if (sharedRefcount->strongref.load() > 0) {
|
||||
if (sharedRefcount->strongref.loadRelaxed() > 0) {
|
||||
qWarning("QObject: shared QObject was deleted directly. The program is malformed and may crash.");
|
||||
// but continue deleting, it's too late to stop anyway
|
||||
}
|
||||
|
||||
// indicate to all QWeakPointers that this QObject has now been deleted
|
||||
sharedRefcount->strongref.store(0);
|
||||
sharedRefcount->strongref.storeRelaxed(0);
|
||||
if (!sharedRefcount->weakref.deref())
|
||||
delete sharedRefcount;
|
||||
}
|
||||
@ -971,7 +971,7 @@ QObject::~QObject()
|
||||
}
|
||||
}
|
||||
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed();
|
||||
if (cd) {
|
||||
if (cd->currentSender) {
|
||||
cd->currentSender->receiverDeleted();
|
||||
@ -986,14 +986,14 @@ QObject::~QObject()
|
||||
for (int signal = -1; signal < receiverCount; ++signal) {
|
||||
QObjectPrivate::ConnectionList &connectionList = cd->connectionsForSignal(signal);
|
||||
|
||||
while (QObjectPrivate::Connection *c = connectionList.first.load()) {
|
||||
while (QObjectPrivate::Connection *c = connectionList.first.loadRelaxed()) {
|
||||
Q_ASSERT(c->receiver);
|
||||
|
||||
QBasicMutex *m = signalSlotLock(c->receiver.load());
|
||||
QBasicMutex *m = signalSlotLock(c->receiver.loadRelaxed());
|
||||
bool needToUnlock = QOrderedMutexLocker::relock(signalSlotMutex, m);
|
||||
if (c->receiver) {
|
||||
cd->removeConnection(c);
|
||||
Q_ASSERT(connectionList.first.load() != c);
|
||||
Q_ASSERT(connectionList.first.loadRelaxed() != c);
|
||||
}
|
||||
if (needToUnlock)
|
||||
m->unlock();
|
||||
@ -1019,7 +1019,7 @@ QObject::~QObject()
|
||||
continue;
|
||||
}
|
||||
|
||||
QObjectPrivate::ConnectionData *senderData = sender->d_func()->connections.load();
|
||||
QObjectPrivate::ConnectionData *senderData = sender->d_func()->connections.loadRelaxed();
|
||||
Q_ASSERT(senderData);
|
||||
|
||||
QtPrivate::QSlotObjectBase *slotObj = nullptr;
|
||||
@ -1041,11 +1041,11 @@ QObject::~QObject()
|
||||
|
||||
// invalidate all connections on the object and make sure
|
||||
// activate() will skip them
|
||||
cd->currentConnectionId.store(0);
|
||||
cd->currentConnectionId.storeRelaxed(0);
|
||||
}
|
||||
if (cd && !cd->ref.deref())
|
||||
delete cd;
|
||||
d->connections.store(nullptr);
|
||||
d->connections.storeRelaxed(nullptr);
|
||||
|
||||
if (!d->children.isEmpty())
|
||||
d->deleteChildren();
|
||||
@ -1065,7 +1065,7 @@ QObject::~QObject()
|
||||
QObjectPrivate::Connection::~Connection()
|
||||
{
|
||||
if (ownArgumentTypes) {
|
||||
const int *v = argumentTypes.load();
|
||||
const int *v = argumentTypes.loadRelaxed();
|
||||
if (v != &DIRECT_CONNECTION_ONLY)
|
||||
delete [] v;
|
||||
}
|
||||
@ -1274,7 +1274,7 @@ bool QObject::event(QEvent *e)
|
||||
{
|
||||
QAbstractMetaCallEvent *mce = static_cast<QAbstractMetaCallEvent*>(e);
|
||||
|
||||
if (!d_func()->connections.load()) {
|
||||
if (!d_func()->connections.loadRelaxed()) {
|
||||
QBasicMutexLocker locker(signalSlotLock(this));
|
||||
d_func()->ensureConnectionData();
|
||||
}
|
||||
@ -1287,7 +1287,7 @@ bool QObject::event(QEvent *e)
|
||||
case QEvent::ThreadChange: {
|
||||
Q_D(QObject);
|
||||
QThreadData *threadData = d->threadData;
|
||||
QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher.loadRelaxed();
|
||||
if (eventDispatcher) {
|
||||
QList<QAbstractEventDispatcher::TimerInfo> timers = eventDispatcher->registeredTimers(this);
|
||||
if (!timers.isEmpty()) {
|
||||
@ -1522,7 +1522,7 @@ void QObject::moveToThread(QThread *targetThread)
|
||||
} else if (d->threadData != currentData) {
|
||||
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
|
||||
"Cannot move to target thread (%p)\n",
|
||||
currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : nullptr);
|
||||
currentData->thread.loadRelaxed(), d->threadData->thread.loadRelaxed(), targetData ? targetData->thread.loadRelaxed() : nullptr);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
qWarning("You might be loading two sets of Qt binaries into the same process. "
|
||||
@ -1587,11 +1587,11 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
|
||||
}
|
||||
if (eventsMoved > 0 && targetData->hasEventDispatcher()) {
|
||||
targetData->canWait = false;
|
||||
targetData->eventDispatcher.load()->wakeUp();
|
||||
targetData->eventDispatcher.loadRelaxed()->wakeUp();
|
||||
}
|
||||
|
||||
// the current emitting thread shouldn't restore currentSender after calling moveToThread()
|
||||
ConnectionData *cd = connections.load();
|
||||
ConnectionData *cd = connections.loadRelaxed();
|
||||
if (cd) {
|
||||
if (cd->currentSender) {
|
||||
cd->currentSender->receiverDeleted();
|
||||
@ -1602,14 +1602,14 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData
|
||||
if (cd) {
|
||||
auto *c = cd->senders;
|
||||
while (c) {
|
||||
QObject *r = c->receiver.load();
|
||||
QObject *r = c->receiver.loadRelaxed();
|
||||
if (r) {
|
||||
Q_ASSERT(r == q);
|
||||
targetData->ref();
|
||||
QThreadData *old = c->receiverThreadData.load();
|
||||
QThreadData *old = c->receiverThreadData.loadRelaxed();
|
||||
if (old)
|
||||
old->deref();
|
||||
c->receiverThreadData.store(targetData);
|
||||
c->receiverThreadData.storeRelaxed(targetData);
|
||||
}
|
||||
c = c->next;
|
||||
}
|
||||
@ -1632,7 +1632,7 @@ void QObjectPrivate::_q_reregisterTimers(void *pointer)
|
||||
{
|
||||
Q_Q(QObject);
|
||||
QList<QAbstractEventDispatcher::TimerInfo> *timerList = reinterpret_cast<QList<QAbstractEventDispatcher::TimerInfo> *>(pointer);
|
||||
QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = threadData->eventDispatcher.loadRelaxed();
|
||||
for (int i = 0; i < timerList->size(); ++i) {
|
||||
const QAbstractEventDispatcher::TimerInfo &ti = timerList->at(i);
|
||||
eventDispatcher->registerTimer(ti.timerId, ti.interval, ti.timerType, q);
|
||||
@ -1698,7 +1698,7 @@ int QObject::startTimer(int interval, Qt::TimerType timerType)
|
||||
qWarning("QObject::startTimer: Timers cannot be started from another thread");
|
||||
return 0;
|
||||
}
|
||||
int timerId = d->threadData->eventDispatcher.load()->registerTimer(interval, timerType, this);
|
||||
int timerId = d->threadData->eventDispatcher.loadRelaxed()->registerTimer(interval, timerType, this);
|
||||
if (!d->extraData)
|
||||
d->extraData = new QObjectPrivate::ExtraData;
|
||||
d->extraData->runningTimers.append(timerId);
|
||||
@ -1773,7 +1773,7 @@ void QObject::killTimer(int id)
|
||||
}
|
||||
|
||||
if (d->threadData->hasEventDispatcher())
|
||||
d->threadData->eventDispatcher.load()->unregisterTimer(id);
|
||||
d->threadData->eventDispatcher.loadRelaxed()->unregisterTimer(id);
|
||||
|
||||
d->extraData->runningTimers.remove(at);
|
||||
QAbstractEventDispatcherPrivate::releaseTimerId(id);
|
||||
@ -2442,7 +2442,7 @@ QObject *QObject::sender() const
|
||||
Q_D(const QObject);
|
||||
|
||||
QBasicMutexLocker locker(signalSlotLock(this));
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed();
|
||||
if (!cd || !cd->currentSender)
|
||||
return nullptr;
|
||||
|
||||
@ -2484,7 +2484,7 @@ int QObject::senderSignalIndex() const
|
||||
Q_D(const QObject);
|
||||
|
||||
QBasicMutexLocker locker(signalSlotLock(this));
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed();
|
||||
if (!cd || !cd->currentSender)
|
||||
return -1;
|
||||
|
||||
@ -2547,13 +2547,13 @@ int QObject::receivers(const char *signal) const
|
||||
signal_index);
|
||||
}
|
||||
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed();
|
||||
QBasicMutexLocker locker(signalSlotLock(this));
|
||||
if (cd && signal_index < cd->signalVectorCount()) {
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.load()->at(signal_index).first.load();
|
||||
const QObjectPrivate::Connection *c = cd->signalVector.loadRelaxed()->at(signal_index).first.loadRelaxed();
|
||||
while (c) {
|
||||
receivers += c->receiver.load() ? 1 : 0;
|
||||
c = c->nextConnectionList.load();
|
||||
receivers += c->receiver.loadRelaxed() ? 1 : 0;
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3362,17 +3362,17 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
|
||||
QOrderedMutexLocker locker(signalSlotLock(sender),
|
||||
signalSlotLock(receiver));
|
||||
|
||||
QObjectPrivate::ConnectionData *scd = QObjectPrivate::get(s)->connections.load();
|
||||
QObjectPrivate::ConnectionData *scd = QObjectPrivate::get(s)->connections.loadRelaxed();
|
||||
if (type & Qt::UniqueConnection && scd) {
|
||||
if (scd->signalVectorCount() > signal_index) {
|
||||
const QObjectPrivate::Connection *c2 = scd->signalVector.load()->at(signal_index).first.load();
|
||||
const QObjectPrivate::Connection *c2 = scd->signalVector.loadRelaxed()->at(signal_index).first.loadRelaxed();
|
||||
|
||||
int method_index_absolute = method_index + method_offset;
|
||||
|
||||
while (c2) {
|
||||
if (!c2->isSlotObject && c2->receiver.load() == receiver && c2->method() == method_index_absolute)
|
||||
if (!c2->isSlotObject && c2->receiver.loadRelaxed() == receiver && c2->method() == method_index_absolute)
|
||||
return nullptr;
|
||||
c2 = c2->nextConnectionList.load();
|
||||
c2 = c2->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
type &= Qt::UniqueConnection - 1;
|
||||
@ -3381,15 +3381,15 @@ QObjectPrivate::Connection *QMetaObjectPrivate::connect(const QObject *sender,
|
||||
QScopedPointer<QObjectPrivate::Connection> c(new QObjectPrivate::Connection);
|
||||
c->sender = s;
|
||||
c->signal_index = signal_index;
|
||||
c->receiver.store(r);
|
||||
c->receiver.storeRelaxed(r);
|
||||
QThreadData *td = r->d_func()->threadData;
|
||||
td->ref();
|
||||
c->receiverThreadData.store(td);
|
||||
c->receiverThreadData.storeRelaxed(td);
|
||||
c->method_relative = method_index;
|
||||
c->method_offset = method_offset;
|
||||
c->connectionType = type;
|
||||
c->isSlotObject = false;
|
||||
c->argumentTypes.store(types);
|
||||
c->argumentTypes.storeRelaxed(types);
|
||||
c->callFunction = callFunction;
|
||||
|
||||
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
|
||||
@ -3442,9 +3442,9 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::ConnectionData *connec
|
||||
bool success = false;
|
||||
|
||||
auto &connectionList = connections->connectionsForSignal(signalIndex);
|
||||
auto *c = connectionList.first.load();
|
||||
auto *c = connectionList.first.loadRelaxed();
|
||||
while (c) {
|
||||
QObject *r = c->receiver.load();
|
||||
QObject *r = c->receiver.loadRelaxed();
|
||||
if (r && (receiver == nullptr || (r == receiver
|
||||
&& (method_index < 0 || (!c->isSlotObject && c->method() == method_index))
|
||||
&& (slot == nullptr || (c->isSlotObject && c->slotObj->compare(slot)))))) {
|
||||
@ -3455,7 +3455,7 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::ConnectionData *connec
|
||||
// need to relock this receiver and sender in the correct order
|
||||
needToUnlock = QOrderedMutexLocker::relock(senderMutex, receiverMutex);
|
||||
}
|
||||
if (c->receiver.load())
|
||||
if (c->receiver.loadRelaxed())
|
||||
connections->removeConnection(c);
|
||||
|
||||
if (needToUnlock)
|
||||
@ -3466,7 +3466,7 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::ConnectionData *connec
|
||||
if (disconnectType == DisconnectOne)
|
||||
return success;
|
||||
}
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@ -3488,7 +3488,7 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender,
|
||||
QBasicMutex *senderMutex = signalSlotLock(sender);
|
||||
QBasicMutexLocker locker(senderMutex);
|
||||
|
||||
QObjectPrivate::ConnectionData *scd = QObjectPrivate::get(s)->connections.load();
|
||||
QObjectPrivate::ConnectionData *scd = QObjectPrivate::get(s)->connections.loadRelaxed();
|
||||
if (!scd)
|
||||
return false;
|
||||
|
||||
@ -3630,7 +3630,7 @@ void QMetaObject::connectSlotsByName(QObject *o)
|
||||
*/
|
||||
static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connection *c, void **argv)
|
||||
{
|
||||
const int *argumentTypes = c->argumentTypes.load();
|
||||
const int *argumentTypes = c->argumentTypes.loadRelaxed();
|
||||
if (!argumentTypes) {
|
||||
QMetaMethod m = QMetaObjectPrivate::signal(sender->metaObject(), signal);
|
||||
argumentTypes = queuedConnectionTypes(m.parameterTypes());
|
||||
@ -3639,7 +3639,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
|
||||
if (!c->argumentTypes.testAndSetOrdered(0, argumentTypes)) {
|
||||
if (argumentTypes != &DIRECT_CONNECTION_ONLY)
|
||||
delete [] argumentTypes;
|
||||
argumentTypes = c->argumentTypes.load();
|
||||
argumentTypes = c->argumentTypes.loadRelaxed();
|
||||
}
|
||||
}
|
||||
if (argumentTypes == &DIRECT_CONNECTION_ONLY) // cannot activate
|
||||
@ -3662,8 +3662,8 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
|
||||
args[n] = QMetaType::create(types[n], argv[n]);
|
||||
}
|
||||
|
||||
QBasicMutexLocker locker(signalSlotLock(c->receiver.load()));
|
||||
if (!c->receiver.load()) {
|
||||
QBasicMutexLocker locker(signalSlotLock(c->receiver.loadRelaxed()));
|
||||
if (!c->receiver.loadRelaxed()) {
|
||||
// the connection has been disconnected before we got the lock
|
||||
locker.unlock();
|
||||
for (int n = 1; n < nargs; ++n)
|
||||
@ -3676,7 +3676,7 @@ static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connect
|
||||
QMetaCallEvent *ev = c->isSlotObject ?
|
||||
new QMetaCallEvent(c->slotObj, sender, signal, nargs, types, args) :
|
||||
new QMetaCallEvent(c->method_offset, c->method_relative, c->callFunction, sender, signal, nargs, types, args);
|
||||
QCoreApplication::postEvent(c->receiver.load(), ev);
|
||||
QCoreApplication::postEvent(c->receiver.loadRelaxed(), ev);
|
||||
}
|
||||
|
||||
template <bool callbacks_enabled>
|
||||
@ -3717,8 +3717,8 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
bool senderDeleted = false;
|
||||
{
|
||||
Q_ASSERT(sp->connections);
|
||||
QObjectPrivate::ConnectionDataPointer connections(sp->connections.load());
|
||||
QObjectPrivate::SignalVector *signalVector = connections->signalVector.load();
|
||||
QObjectPrivate::ConnectionDataPointer connections(sp->connections.loadRelaxed());
|
||||
QObjectPrivate::SignalVector *signalVector = connections->signalVector.loadRelaxed();
|
||||
|
||||
const QObjectPrivate::ConnectionList *list;
|
||||
if (signal_index < signalVector->count())
|
||||
@ -3727,32 +3727,32 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
list = &signalVector->at(-1);
|
||||
|
||||
Qt::HANDLE currentThreadId = QThread::currentThreadId();
|
||||
bool inSenderThread = currentThreadId == QObjectPrivate::get(sender)->threadData->threadId.load();
|
||||
bool inSenderThread = currentThreadId == QObjectPrivate::get(sender)->threadData->threadId.loadRelaxed();
|
||||
|
||||
// We need to check against the highest connection id to ensure that signals added
|
||||
// during the signal emission are not emitted in this emission.
|
||||
uint highestConnectionId = connections->currentConnectionId.load();
|
||||
uint highestConnectionId = connections->currentConnectionId.loadRelaxed();
|
||||
do {
|
||||
QObjectPrivate::Connection *c = list->first.load();
|
||||
QObjectPrivate::Connection *c = list->first.loadRelaxed();
|
||||
if (!c)
|
||||
continue;
|
||||
|
||||
do {
|
||||
QObject * const receiver = c->receiver.load();
|
||||
QObject * const receiver = c->receiver.loadRelaxed();
|
||||
if (!receiver)
|
||||
continue;
|
||||
|
||||
QThreadData *td = c->receiverThreadData.load();
|
||||
QThreadData *td = c->receiverThreadData.loadRelaxed();
|
||||
if (!td)
|
||||
continue;
|
||||
|
||||
bool receiverInSameThread;
|
||||
if (inSenderThread) {
|
||||
receiverInSameThread = currentThreadId == td->threadId.load();
|
||||
receiverInSameThread = currentThreadId == td->threadId.loadRelaxed();
|
||||
} else {
|
||||
// need to lock before reading the threadId, because moveToThread() could interfere
|
||||
QMutexLocker lock(signalSlotLock(receiver));
|
||||
receiverInSameThread = currentThreadId == td->threadId.load();
|
||||
receiverInSameThread = currentThreadId == td->threadId.loadRelaxed();
|
||||
}
|
||||
|
||||
|
||||
@ -3825,17 +3825,17 @@ void doActivate(QObject *sender, int signal_index, void **argv)
|
||||
if (callbacks_enabled && signal_spy_set->slot_end_callback != nullptr)
|
||||
signal_spy_set->slot_end_callback(receiver, method);
|
||||
}
|
||||
} while ((c = c->nextConnectionList.load()) != nullptr && c->id <= highestConnectionId);
|
||||
} while ((c = c->nextConnectionList.loadRelaxed()) != nullptr && c->id <= highestConnectionId);
|
||||
|
||||
} while (list != &signalVector->at(-1) &&
|
||||
//start over for all signals;
|
||||
((list = &signalVector->at(-1)), true));
|
||||
|
||||
if (connections->currentConnectionId.load() == 0)
|
||||
if (connections->currentConnectionId.loadRelaxed() == 0)
|
||||
senderDeleted = true;
|
||||
}
|
||||
if (!senderDeleted)
|
||||
sp->connections.load()->cleanOrphanedConnections(sender);
|
||||
sp->connections.loadRelaxed()->cleanOrphanedConnections(sender);
|
||||
|
||||
if (callbacks_enabled && signal_spy_set->signal_end_callback != nullptr)
|
||||
signal_spy_set->signal_end_callback(sender, signal_index);
|
||||
@ -3849,7 +3849,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
|
||||
{
|
||||
int signal_index = local_signal_index + QMetaObjectPrivate::signalOffset(m);
|
||||
|
||||
if (Q_UNLIKELY(qt_signal_spy_callback_set.load()))
|
||||
if (Q_UNLIKELY(qt_signal_spy_callback_set.loadRelaxed()))
|
||||
doActivate<true>(sender, signal_index, argv);
|
||||
else
|
||||
doActivate<false>(sender, signal_index, argv);
|
||||
@ -3862,7 +3862,7 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
|
||||
{
|
||||
int signal_index = signalOffset + local_signal_index;
|
||||
|
||||
if (Q_UNLIKELY(qt_signal_spy_callback_set.load()))
|
||||
if (Q_UNLIKELY(qt_signal_spy_callback_set.loadRelaxed()))
|
||||
doActivate<true>(sender, signal_index, argv);
|
||||
else
|
||||
doActivate<false>(sender, signal_index, argv);
|
||||
@ -4131,11 +4131,11 @@ void QObject::dumpObjectInfo() const
|
||||
// first, look for connections where this object is the sender
|
||||
qDebug(" SIGNALS OUT");
|
||||
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.load();
|
||||
QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed();
|
||||
if (cd && cd->signalVectorCount()) {
|
||||
QObjectPrivate::SignalVector *signalVector = cd->signalVector.load();
|
||||
QObjectPrivate::SignalVector *signalVector = cd->signalVector.loadRelaxed();
|
||||
for (int signal_index = 0; signal_index < signalVector->count(); ++signal_index) {
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signal_index).first.load();
|
||||
const QObjectPrivate::Connection *c = signalVector->at(signal_index).first.loadRelaxed();
|
||||
if (!c)
|
||||
continue;
|
||||
const QMetaMethod signal = QMetaObjectPrivate::signal(metaObject(), signal_index);
|
||||
@ -4143,23 +4143,23 @@ void QObject::dumpObjectInfo() const
|
||||
|
||||
// receivers
|
||||
while (c) {
|
||||
if (!c->receiver.load()) {
|
||||
if (!c->receiver.loadRelaxed()) {
|
||||
qDebug(" <Disconnected receiver>");
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
continue;
|
||||
}
|
||||
if (c->isSlotObject) {
|
||||
qDebug(" <functor or function pointer>");
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
continue;
|
||||
}
|
||||
const QMetaObject *receiverMetaObject = c->receiver.load()->metaObject();
|
||||
const QMetaObject *receiverMetaObject = c->receiver.loadRelaxed()->metaObject();
|
||||
const QMetaMethod method = receiverMetaObject->method(c->method());
|
||||
qDebug(" --> %s::%s %s",
|
||||
receiverMetaObject->className(),
|
||||
c->receiver.load()->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver.load()->objectName()),
|
||||
c->receiver.loadRelaxed()->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver.loadRelaxed()->objectName()),
|
||||
method.methodSignature().constData());
|
||||
c = c->nextConnectionList.load();
|
||||
c = c->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -4910,17 +4910,17 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
|
||||
QOrderedMutexLocker locker(signalSlotLock(sender),
|
||||
signalSlotLock(receiver));
|
||||
|
||||
if (type & Qt::UniqueConnection && slot && QObjectPrivate::get(s)->connections.load()) {
|
||||
QObjectPrivate::ConnectionData *connections = QObjectPrivate::get(s)->connections.load();
|
||||
if (type & Qt::UniqueConnection && slot && QObjectPrivate::get(s)->connections.loadRelaxed()) {
|
||||
QObjectPrivate::ConnectionData *connections = QObjectPrivate::get(s)->connections.loadRelaxed();
|
||||
if (connections->signalVectorCount() > signal_index) {
|
||||
const QObjectPrivate::Connection *c2 = connections->signalVector.load()->at(signal_index).first.load();
|
||||
const QObjectPrivate::Connection *c2 = connections->signalVector.loadRelaxed()->at(signal_index).first.loadRelaxed();
|
||||
|
||||
while (c2) {
|
||||
if (c2->receiver.load() == receiver && c2->isSlotObject && c2->slotObj->compare(slot)) {
|
||||
if (c2->receiver.loadRelaxed() == receiver && c2->isSlotObject && c2->slotObj->compare(slot)) {
|
||||
slotObj->destroyIfLastRef();
|
||||
return QMetaObject::Connection();
|
||||
}
|
||||
c2 = c2->nextConnectionList.load();
|
||||
c2 = c2->nextConnectionList.loadRelaxed();
|
||||
}
|
||||
}
|
||||
type = static_cast<Qt::ConnectionType>(type ^ Qt::UniqueConnection);
|
||||
@ -4931,13 +4931,13 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
|
||||
c->signal_index = signal_index;
|
||||
QThreadData *td = r->d_func()->threadData;
|
||||
td->ref();
|
||||
c->receiverThreadData.store(td);
|
||||
c->receiver.store(r);
|
||||
c->receiverThreadData.storeRelaxed(td);
|
||||
c->receiver.storeRelaxed(r);
|
||||
c->slotObj = slotObj;
|
||||
c->connectionType = type;
|
||||
c->isSlotObject = true;
|
||||
if (types) {
|
||||
c->argumentTypes.store(types);
|
||||
c->argumentTypes.storeRelaxed(types);
|
||||
c->ownArgumentTypes = false;
|
||||
}
|
||||
|
||||
@ -4966,7 +4966,7 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
|
||||
|
||||
if (!c)
|
||||
return false;
|
||||
QObject *receiver = c->receiver.load();
|
||||
QObject *receiver = c->receiver.loadRelaxed();
|
||||
if (!receiver)
|
||||
return false;
|
||||
|
||||
@ -4978,11 +4978,11 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
|
||||
QOrderedMutexLocker locker(senderMutex, receiverMutex);
|
||||
|
||||
// load receiver once again and recheck to ensure nobody else has removed the connection in the meantime
|
||||
receiver = c->receiver.load();
|
||||
receiver = c->receiver.loadRelaxed();
|
||||
if (!receiver)
|
||||
return false;
|
||||
|
||||
connections = QObjectPrivate::get(c->sender)->connections.load();
|
||||
connections = QObjectPrivate::get(c->sender)->connections.loadRelaxed();
|
||||
Q_ASSERT(connections);
|
||||
connections->removeConnection(c);
|
||||
}
|
||||
@ -5174,7 +5174,7 @@ bool QMetaObject::Connection::isConnected_helper() const
|
||||
Q_ASSERT(d_ptr); // we're only called from operator RestrictedBool() const
|
||||
QObjectPrivate::Connection *c = static_cast<QObjectPrivate::Connection *>(d_ptr);
|
||||
|
||||
return c->receiver.load();
|
||||
return c->receiver.loadRelaxed();
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,7 +184,7 @@ public:
|
||||
}
|
||||
void deref() {
|
||||
if (!ref_.deref()) {
|
||||
Q_ASSERT(!receiver.load());
|
||||
Q_ASSERT(!receiver.loadRelaxed());
|
||||
Q_ASSERT(!isSlotObject);
|
||||
delete this;
|
||||
}
|
||||
@ -202,7 +202,7 @@ public:
|
||||
: receiver(receiver), sender(sender), signal(signal)
|
||||
{
|
||||
if (receiver) {
|
||||
ConnectionData *cd = receiver->d_func()->connections.load();
|
||||
ConnectionData *cd = receiver->d_func()->connections.loadRelaxed();
|
||||
previous = cd->currentSender;
|
||||
cd->currentSender = this;
|
||||
}
|
||||
@ -210,7 +210,7 @@ public:
|
||||
~Sender()
|
||||
{
|
||||
if (receiver)
|
||||
receiver->d_func()->connections.load()->currentSender = previous;
|
||||
receiver->d_func()->connections.loadRelaxed()->currentSender = previous;
|
||||
}
|
||||
void receiverDeleted()
|
||||
{
|
||||
@ -268,8 +268,8 @@ public:
|
||||
|
||||
~ConnectionData()
|
||||
{
|
||||
deleteOrphaned(orphaned.load());
|
||||
SignalVector *v = signalVector.load();
|
||||
deleteOrphaned(orphaned.loadRelaxed());
|
||||
SignalVector *v = signalVector.loadRelaxed();
|
||||
if (v)
|
||||
free(v);
|
||||
}
|
||||
@ -279,18 +279,18 @@ public:
|
||||
void removeConnection(Connection *c);
|
||||
void cleanOrphanedConnections(QObject *sender)
|
||||
{
|
||||
if (orphaned.load() && ref == 1)
|
||||
if (orphaned.loadRelaxed() && ref == 1)
|
||||
cleanOrphanedConnectionsImpl(sender);
|
||||
}
|
||||
void cleanOrphanedConnectionsImpl(QObject *sender);
|
||||
|
||||
ConnectionList &connectionsForSignal(int signal)
|
||||
{
|
||||
return signalVector.load()->at(signal);
|
||||
return signalVector.loadRelaxed()->at(signal);
|
||||
}
|
||||
|
||||
void resizeSignalVector(uint size) {
|
||||
SignalVector *vector = this->signalVector.load();
|
||||
SignalVector *vector = this->signalVector.loadRelaxed();
|
||||
if (vector && vector->allocated > size)
|
||||
return;
|
||||
size = (size + 7) & ~7;
|
||||
@ -305,14 +305,14 @@ public:
|
||||
newVector->next = nullptr;
|
||||
newVector->allocated = size;
|
||||
|
||||
signalVector.store(newVector);
|
||||
signalVector.storeRelaxed(newVector);
|
||||
if (vector) {
|
||||
vector->nextInOrphanList = orphaned.load();
|
||||
orphaned.store(ConnectionOrSignalVector::fromSignalVector(vector));
|
||||
vector->nextInOrphanList = orphaned.loadRelaxed();
|
||||
orphaned.storeRelaxed(ConnectionOrSignalVector::fromSignalVector(vector));
|
||||
}
|
||||
}
|
||||
int signalVectorCount() const {
|
||||
return signalVector ? signalVector.load()->count() : -1;
|
||||
return signalVector ? signalVector.loadRelaxed()->count() : -1;
|
||||
}
|
||||
|
||||
static void deleteOrphaned(ConnectionOrSignalVector *c);
|
||||
@ -366,11 +366,11 @@ public:
|
||||
|
||||
void ensureConnectionData()
|
||||
{
|
||||
if (connections.load())
|
||||
if (connections.loadRelaxed())
|
||||
return;
|
||||
ConnectionData *cd = new ConnectionData;
|
||||
cd->ref.ref();
|
||||
connections.store(cd);
|
||||
connections.storeRelaxed(cd);
|
||||
}
|
||||
public:
|
||||
ExtraData *extraData; // extra data set by the user
|
||||
|
@ -152,7 +152,7 @@ QSocketNotifier::QSocketNotifier(qintptr socket, Type type, QObject *parent)
|
||||
else if (!d->threadData->hasEventDispatcher())
|
||||
qWarning("QSocketNotifier: Can only be used with threads started with QThread");
|
||||
else
|
||||
d->threadData->eventDispatcher.load()->registerSocketNotifier(this);
|
||||
d->threadData->eventDispatcher.loadRelaxed()->registerSocketNotifier(this);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -241,9 +241,9 @@ void QSocketNotifier::setEnabled(bool enable)
|
||||
return;
|
||||
}
|
||||
if (d->snenabled)
|
||||
d->threadData->eventDispatcher.load()->registerSocketNotifier(this);
|
||||
d->threadData->eventDispatcher.loadRelaxed()->registerSocketNotifier(this);
|
||||
else
|
||||
d->threadData->eventDispatcher.load()->unregisterSocketNotifier(this);
|
||||
d->threadData->eventDispatcher.loadRelaxed()->unregisterSocketNotifier(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2366,7 +2366,7 @@ QVariant& QVariant::operator=(const QVariant &variant)
|
||||
|
||||
void QVariant::detach()
|
||||
{
|
||||
if (!d.is_shared || d.data.shared->ref.load() == 1)
|
||||
if (!d.is_shared || d.data.shared->ref.loadRelaxed() == 1)
|
||||
return;
|
||||
|
||||
Private dd;
|
||||
|
@ -577,7 +577,7 @@ Q_CORE_EXPORT QDataStream& operator<< (QDataStream& s, const QVariant::Type p);
|
||||
#endif
|
||||
|
||||
inline bool QVariant::isDetached() const
|
||||
{ return !d.is_shared || d.data.shared->ref.load() == 1; }
|
||||
{ return !d.is_shared || d.data.shared->ref.loadRelaxed() == 1; }
|
||||
|
||||
|
||||
#ifdef Q_QDOC
|
||||
|
@ -124,7 +124,7 @@ QWinEventNotifier::QWinEventNotifier(HANDLE hEvent, QObject *parent)
|
||||
: QObject(*new QWinEventNotifierPrivate(hEvent, false), parent)
|
||||
{
|
||||
Q_D(QWinEventNotifier);
|
||||
QAbstractEventDispatcher *eventDispatcher = d->threadData->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = d->threadData->eventDispatcher.loadRelaxed();
|
||||
if (Q_UNLIKELY(!eventDispatcher)) {
|
||||
qWarning("QWinEventNotifier: Can only be used with threads started with QThread");
|
||||
return;
|
||||
@ -197,7 +197,7 @@ void QWinEventNotifier::setEnabled(bool enable)
|
||||
return;
|
||||
d->enabled = enable;
|
||||
|
||||
QAbstractEventDispatcher *eventDispatcher = d->threadData->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = d->threadData->eventDispatcher.loadRelaxed();
|
||||
if (!eventDispatcher) { // perhaps application is shutting down
|
||||
if (!enable && d->waitHandle != nullptr)
|
||||
d->unregisterWaitObject();
|
||||
@ -256,7 +256,7 @@ void QWinEventNotifierPrivate::unregisterWaitObject()
|
||||
static void CALLBACK wfsoCallback(void *context, BOOLEAN /*ignore*/)
|
||||
{
|
||||
QWinEventNotifierPrivate *nd = reinterpret_cast<QWinEventNotifierPrivate *>(context);
|
||||
QAbstractEventDispatcher *eventDispatcher = nd->threadData->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = nd->threadData->eventDispatcher.loadRelaxed();
|
||||
|
||||
// Happens when Q(Core)Application is destroyed before QWinEventNotifier.
|
||||
// https://bugreports.qt.io/browse/QTBUG-70214
|
||||
|
@ -405,10 +405,10 @@ inline void QLibraryStore::cleanup()
|
||||
LibraryMap::Iterator it = data->libraryMap.begin();
|
||||
for (; it != data->libraryMap.end(); ++it) {
|
||||
QLibraryPrivate *lib = it.value();
|
||||
if (lib->libraryRefCount.load() == 1) {
|
||||
if (lib->libraryUnloadCount.load() > 0) {
|
||||
if (lib->libraryRefCount.loadRelaxed() == 1) {
|
||||
if (lib->libraryUnloadCount.loadRelaxed() > 0) {
|
||||
Q_ASSERT(lib->pHnd);
|
||||
lib->libraryUnloadCount.store(1);
|
||||
lib->libraryUnloadCount.storeRelaxed(1);
|
||||
#ifdef __GLIBC__
|
||||
// glibc has a bug in unloading from global destructors
|
||||
// see https://bugzilla.novell.com/show_bug.cgi?id=622977
|
||||
@ -428,7 +428,7 @@ inline void QLibraryStore::cleanup()
|
||||
for (QLibraryPrivate *lib : qAsConst(data->libraryMap)) {
|
||||
if (lib)
|
||||
qDebug() << "On QtCore unload," << lib->fileName << "was leaked, with"
|
||||
<< lib->libraryRefCount.load() << "users";
|
||||
<< lib->libraryRefCount.loadRelaxed() << "users";
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ inline void QLibraryStore::releaseLibrary(QLibraryPrivate *lib)
|
||||
}
|
||||
|
||||
// no one else is using
|
||||
Q_ASSERT(lib->libraryUnloadCount.load() == 0);
|
||||
Q_ASSERT(lib->libraryUnloadCount.loadRelaxed() == 0);
|
||||
|
||||
if (Q_LIKELY(data) && !lib->fileName.isEmpty()) {
|
||||
QLibraryPrivate *that = data->libraryMap.take(lib->fileName);
|
||||
@ -501,7 +501,7 @@ QLibraryPrivate::QLibraryPrivate(const QString &canonicalFileName, const QString
|
||||
: pHnd(0), fileName(canonicalFileName), fullVersion(version), instance(0),
|
||||
libraryRefCount(0), libraryUnloadCount(0), pluginState(MightBeAPlugin)
|
||||
{
|
||||
loadHintsInt.store(loadHints);
|
||||
loadHintsInt.storeRelaxed(loadHints);
|
||||
if (canonicalFileName.isEmpty())
|
||||
errorString = QLibrary::tr("The shared library was not found.");
|
||||
}
|
||||
@ -522,7 +522,7 @@ void QLibraryPrivate::mergeLoadHints(QLibrary::LoadHints lh)
|
||||
if (pHnd)
|
||||
return;
|
||||
|
||||
loadHintsInt.store(lh);
|
||||
loadHintsInt.storeRelaxed(lh);
|
||||
}
|
||||
|
||||
QFunctionPointer QLibraryPrivate::resolve(const char *symbol)
|
||||
@ -575,7 +575,7 @@ bool QLibraryPrivate::unload(UnloadFlag flag)
|
||||
{
|
||||
if (!pHnd)
|
||||
return false;
|
||||
if (libraryUnloadCount.load() > 0 && !libraryUnloadCount.deref()) { // only unload if ALL QLibrary instance wanted to
|
||||
if (libraryUnloadCount.loadRelaxed() > 0 && !libraryUnloadCount.deref()) { // only unload if ALL QLibrary instance wanted to
|
||||
delete inst.data();
|
||||
if (flag == NoUnloadSys || unload_sys()) {
|
||||
if (qt_debug_component())
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
QFunctionPointer resolve(const char *);
|
||||
|
||||
QLibrary::LoadHints loadHints() const
|
||||
{ return QLibrary::LoadHints(loadHintsInt.load()); }
|
||||
{ return QLibrary::LoadHints(loadHintsInt.loadRelaxed()); }
|
||||
void setLoadHints(QLibrary::LoadHints lh);
|
||||
|
||||
static QLibraryPrivate *findOrCreate(const QString &fileName, const QString &version = QString(),
|
||||
|
@ -849,7 +849,7 @@ QCborContainerPrivate *QCborContainerPrivate::clone(QCborContainerPrivate *d, qs
|
||||
|
||||
QCborContainerPrivate *QCborContainerPrivate::detach(QCborContainerPrivate *d, qsizetype reserved)
|
||||
{
|
||||
if (!d || d->ref.load() != 1)
|
||||
if (!d || d->ref.loadRelaxed() != 1)
|
||||
return clone(d, reserved);
|
||||
return d;
|
||||
}
|
||||
@ -884,12 +884,12 @@ void QCborContainerPrivate::replaceAt_complex(Element &e, const QCborValue &valu
|
||||
|
||||
// detect self-assignment
|
||||
if (Q_UNLIKELY(this == value.container)) {
|
||||
Q_ASSERT(ref.load() >= 2);
|
||||
Q_ASSERT(ref.loadRelaxed() >= 2);
|
||||
if (disp == MoveContainer)
|
||||
ref.deref(); // not deref() because it can't drop to 0
|
||||
QCborContainerPrivate *d = QCborContainerPrivate::clone(this);
|
||||
d->elements.detach();
|
||||
d->ref.store(1);
|
||||
d->ref.storeRelaxed(1);
|
||||
e.container = d;
|
||||
} else {
|
||||
e.container = value.container;
|
||||
@ -1368,7 +1368,7 @@ static Element decodeBasicValueFromCbor(QCborStreamReader &reader)
|
||||
static inline QCborContainerPrivate *createContainerFromCbor(QCborStreamReader &reader)
|
||||
{
|
||||
auto d = new QCborContainerPrivate;
|
||||
d->ref.store(1);
|
||||
d->ref.storeRelaxed(1);
|
||||
d->decodeFromCbor(reader);
|
||||
return d;
|
||||
}
|
||||
@ -1643,7 +1643,7 @@ QCborValue::QCborValue(const QByteArray &ba)
|
||||
: n(0), container(new QCborContainerPrivate), t(ByteArray)
|
||||
{
|
||||
container->appendByteData(ba.constData(), ba.size(), t);
|
||||
container->ref.store(1);
|
||||
container->ref.storeRelaxed(1);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1656,7 +1656,7 @@ QCborValue::QCborValue(const QString &s)
|
||||
: n(0), container(new QCborContainerPrivate), t(String)
|
||||
{
|
||||
container->append(s);
|
||||
container->ref.store(1);
|
||||
container->ref.storeRelaxed(1);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1671,7 +1671,7 @@ QCborValue::QCborValue(QLatin1String s)
|
||||
: n(0), container(new QCborContainerPrivate), t(String)
|
||||
{
|
||||
container->append(s);
|
||||
container->ref.store(1);
|
||||
container->ref.storeRelaxed(1);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1719,7 +1719,7 @@ QCborValue::QCborValue(const QCborMap &m)
|
||||
QCborValue::QCborValue(QCborTag t, const QCborValue &tv)
|
||||
: n(-1), container(new QCborContainerPrivate), t(Tag)
|
||||
{
|
||||
container->ref.store(1);
|
||||
container->ref.storeRelaxed(1);
|
||||
container->append(t);
|
||||
container->append(tv);
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ public:
|
||||
Data *clone(Base *b, int reserve = 0)
|
||||
{
|
||||
int size = sizeof(Header) + b->size;
|
||||
if (b == header->root() && ref.load() == 1 && alloc >= size + reserve)
|
||||
if (b == header->root() && ref.loadRelaxed() == 1 && alloc >= size + reserve)
|
||||
return this;
|
||||
|
||||
if (reserve) {
|
||||
|
@ -1226,7 +1226,7 @@ bool QJsonArray::detach2(uint reserve)
|
||||
d->ref.ref();
|
||||
return true;
|
||||
}
|
||||
if (reserve == 0 && d->ref.load() == 1)
|
||||
if (reserve == 0 && d->ref.loadRelaxed() == 1)
|
||||
return true;
|
||||
|
||||
QJsonPrivate::Data *x = d->clone(a, reserve);
|
||||
|
@ -646,7 +646,7 @@ bool QJsonObject::operator!=(const QJsonObject &other) const
|
||||
*/
|
||||
QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it)
|
||||
{
|
||||
Q_ASSERT(d && d->ref.load() == 1);
|
||||
Q_ASSERT(d && d->ref.loadRelaxed() == 1);
|
||||
if (it.o != this || it.i < 0 || it.i >= (int)o->length)
|
||||
return iterator(this, o->length);
|
||||
|
||||
@ -1231,7 +1231,7 @@ bool QJsonObject::detach2(uint reserve)
|
||||
d->ref.ref();
|
||||
return true;
|
||||
}
|
||||
if (reserve == 0 && d->ref.load() == 1)
|
||||
if (reserve == 0 && d->ref.loadRelaxed() == 1)
|
||||
return true;
|
||||
|
||||
QJsonPrivate::Data *x = d->clone(o, reserve);
|
||||
|
@ -257,7 +257,7 @@ inline void qAtomicAssign(T *&d, T *x)
|
||||
template <typename T>
|
||||
inline void qAtomicDetach(T *&d)
|
||||
{
|
||||
if (d->ref.load() == 1)
|
||||
if (d->ref.loadRelaxed() == 1)
|
||||
return;
|
||||
T *x = d;
|
||||
d = new T(*d);
|
||||
|
@ -97,7 +97,7 @@ static inline int switch_off(QAtomicInt &a, int which)
|
||||
static inline int switch_from_to(QAtomicInt &a, int from, int to)
|
||||
{
|
||||
int newValue;
|
||||
int expected = a.load();
|
||||
int expected = a.loadRelaxed();
|
||||
do {
|
||||
newValue = (expected & ~from) | to;
|
||||
} while (!a.testAndSetRelaxed(expected, newValue, expected));
|
||||
@ -107,7 +107,7 @@ static inline int switch_from_to(QAtomicInt &a, int from, int to)
|
||||
void QFutureInterfaceBase::cancel()
|
||||
{
|
||||
QMutexLocker locker(&d->m_mutex);
|
||||
if (d->state.load() & Canceled)
|
||||
if (d->state.loadRelaxed() & Canceled)
|
||||
return;
|
||||
|
||||
switch_from_to(d->state, Paused, Canceled);
|
||||
@ -132,7 +132,7 @@ void QFutureInterfaceBase::setPaused(bool paused)
|
||||
void QFutureInterfaceBase::togglePaused()
|
||||
{
|
||||
QMutexLocker locker(&d->m_mutex);
|
||||
if (d->state.load() & Paused) {
|
||||
if (d->state.loadRelaxed() & Paused) {
|
||||
switch_off(d->state, Paused);
|
||||
d->pausedWaitCondition.wakeAll();
|
||||
d->sendCallOut(QFutureCallOutEvent(QFutureCallOutEvent::Resumed));
|
||||
@ -149,7 +149,7 @@ void QFutureInterfaceBase::setThrottled(bool enable)
|
||||
switch_on(d->state, Throttled);
|
||||
} else {
|
||||
switch_off(d->state, Throttled);
|
||||
if (!(d->state.load() & Paused))
|
||||
if (!(d->state.loadRelaxed() & Paused))
|
||||
d->pausedWaitCondition.wakeAll();
|
||||
}
|
||||
}
|
||||
@ -201,13 +201,13 @@ void QFutureInterfaceBase::waitForResume()
|
||||
{
|
||||
// return early if possible to avoid taking the mutex lock.
|
||||
{
|
||||
const int state = d->state.load();
|
||||
const int state = d->state.loadRelaxed();
|
||||
if (!(state & Paused) || (state & Canceled))
|
||||
return;
|
||||
}
|
||||
|
||||
QMutexLocker lock(&d->m_mutex);
|
||||
const int state = d->state.load();
|
||||
const int state = d->state.loadRelaxed();
|
||||
if (!(state & Paused) || (state & Canceled))
|
||||
return;
|
||||
|
||||
@ -256,7 +256,7 @@ bool QFutureInterfaceBase::isProgressUpdateNeeded() const
|
||||
void QFutureInterfaceBase::reportStarted()
|
||||
{
|
||||
QMutexLocker locker(&d->m_mutex);
|
||||
if (d->state.load() & (Started|Canceled|Finished))
|
||||
if (d->state.loadRelaxed() & (Started|Canceled|Finished))
|
||||
return;
|
||||
|
||||
d->setState(State(Started | Running));
|
||||
@ -272,7 +272,7 @@ void QFutureInterfaceBase::reportCanceled()
|
||||
void QFutureInterfaceBase::reportException(const QException &exception)
|
||||
{
|
||||
QMutexLocker locker(&d->m_mutex);
|
||||
if (d->state.load() & (Canceled|Finished))
|
||||
if (d->state.loadRelaxed() & (Canceled|Finished))
|
||||
return;
|
||||
|
||||
d->m_exceptionStore.setException(exception);
|
||||
@ -307,7 +307,7 @@ int QFutureInterfaceBase::expectedResultCount()
|
||||
|
||||
bool QFutureInterfaceBase::queryState(State state) const
|
||||
{
|
||||
return d->state.load() & state;
|
||||
return d->state.loadRelaxed() & state;
|
||||
}
|
||||
|
||||
void QFutureInterfaceBase::waitForResult(int resultIndex)
|
||||
@ -352,7 +352,7 @@ void QFutureInterfaceBase::waitForFinished()
|
||||
|
||||
void QFutureInterfaceBase::reportResultsReady(int beginIndex, int endIndex)
|
||||
{
|
||||
if (beginIndex == endIndex || (d->state.load() & (Canceled|Finished)))
|
||||
if (beginIndex == endIndex || (d->state.loadRelaxed() & (Canceled|Finished)))
|
||||
return;
|
||||
|
||||
d->waitCondition.wakeAll();
|
||||
@ -414,7 +414,7 @@ void QFutureInterfaceBase::setProgressValueAndText(int progressValue,
|
||||
if (d->m_progressValue >= progressValue)
|
||||
return;
|
||||
|
||||
if (d->state.load() & (Canceled|Finished))
|
||||
if (d->state.loadRelaxed() & (Canceled|Finished))
|
||||
return;
|
||||
|
||||
if (d->internal_updateProgress(progressValue, progressText)) {
|
||||
@ -486,10 +486,10 @@ bool QFutureInterfaceBasePrivate::internal_waitForNextResult()
|
||||
if (m_results.hasNextResult())
|
||||
return true;
|
||||
|
||||
while ((state.load() & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false)
|
||||
while ((state.loadRelaxed() & QFutureInterfaceBase::Running) && m_results.hasNextResult() == false)
|
||||
waitCondition.wait(&m_mutex);
|
||||
|
||||
return !(state.load() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult();
|
||||
return !(state.loadRelaxed() & QFutureInterfaceBase::Canceled) && m_results.hasNextResult();
|
||||
}
|
||||
|
||||
bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress,
|
||||
@ -512,8 +512,8 @@ bool QFutureInterfaceBasePrivate::internal_updateProgress(int progress,
|
||||
void QFutureInterfaceBasePrivate::internal_setThrottled(bool enable)
|
||||
{
|
||||
// bail out if we are not changing the state
|
||||
if ((enable && (state.load() & QFutureInterfaceBase::Throttled))
|
||||
|| (!enable && !(state.load() & QFutureInterfaceBase::Throttled)))
|
||||
if ((enable && (state.loadRelaxed() & QFutureInterfaceBase::Throttled))
|
||||
|| (!enable && !(state.loadRelaxed() & QFutureInterfaceBase::Throttled)))
|
||||
return;
|
||||
|
||||
// change the state
|
||||
@ -521,7 +521,7 @@ void QFutureInterfaceBasePrivate::internal_setThrottled(bool enable)
|
||||
switch_on(state, QFutureInterfaceBase::Throttled);
|
||||
} else {
|
||||
switch_off(state, QFutureInterfaceBase::Throttled);
|
||||
if (!(state.load() & QFutureInterfaceBase::Paused))
|
||||
if (!(state.loadRelaxed() & QFutureInterfaceBase::Paused))
|
||||
pausedWaitCondition.wakeAll();
|
||||
}
|
||||
}
|
||||
@ -556,7 +556,7 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
|
||||
if (state.load() & QFutureInterfaceBase::Started) {
|
||||
if (state.loadRelaxed() & QFutureInterfaceBase::Started) {
|
||||
interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Started));
|
||||
interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::ProgressRange,
|
||||
m_progressMinimum,
|
||||
@ -576,13 +576,13 @@ void QFutureInterfaceBasePrivate::connectOutputInterface(QFutureCallOutInterface
|
||||
it.batchedAdvance();
|
||||
}
|
||||
|
||||
if (state.load() & QFutureInterfaceBase::Paused)
|
||||
if (state.loadRelaxed() & QFutureInterfaceBase::Paused)
|
||||
interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Paused));
|
||||
|
||||
if (state.load() & QFutureInterfaceBase::Canceled)
|
||||
if (state.loadRelaxed() & QFutureInterfaceBase::Canceled)
|
||||
interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Canceled));
|
||||
|
||||
if (state.load() & QFutureInterfaceBase::Finished)
|
||||
if (state.loadRelaxed() & QFutureInterfaceBase::Finished)
|
||||
interface->postCallOutEvent(QFutureCallOutEvent(QFutureCallOutEvent::Finished));
|
||||
|
||||
outputConnections.append(interface);
|
||||
@ -601,7 +601,7 @@ void QFutureInterfaceBasePrivate::disconnectOutputInterface(QFutureCallOutInterf
|
||||
|
||||
void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState)
|
||||
{
|
||||
state.store(newState);
|
||||
state.storeRelaxed(newState);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -144,11 +144,11 @@ public:
|
||||
// Default ref counter for QFIBP
|
||||
inline bool ref() { return m_refCount.ref(); }
|
||||
inline bool deref() { return m_refCount.deref(); }
|
||||
inline int load() const { return m_refCount.load(); }
|
||||
inline int load() const { return m_refCount.loadRelaxed(); }
|
||||
// Ref counter for type T
|
||||
inline bool refT() { return m_refCountT.ref(); }
|
||||
inline bool derefT() { return m_refCountT.deref(); }
|
||||
inline int loadT() const { return m_refCountT.load(); }
|
||||
inline int loadT() const { return m_refCountT.loadRelaxed(); }
|
||||
|
||||
private:
|
||||
QAtomicInt m_refCount;
|
||||
|
@ -402,7 +402,7 @@ void QFutureWatcherBase::disconnectOutputInterface(bool pendingAssignment)
|
||||
{
|
||||
if (pendingAssignment) {
|
||||
Q_D(QFutureWatcherBase);
|
||||
d->pendingResultsReady.store(0);
|
||||
d->pendingResultsReady.storeRelaxed(0);
|
||||
qDeleteAll(d->pendingCallOutEvents);
|
||||
d->pendingCallOutEvents.clear();
|
||||
d->finished = false; /* May soon be amended, during connectOutputInterface() */
|
||||
@ -441,7 +441,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
|
||||
emit q->finished();
|
||||
break;
|
||||
case QFutureCallOutEvent::Canceled:
|
||||
pendingResultsReady.store(0);
|
||||
pendingResultsReady.storeRelaxed(0);
|
||||
emit q->canceled();
|
||||
break;
|
||||
case QFutureCallOutEvent::Paused:
|
||||
@ -466,7 +466,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
|
||||
|
||||
emit q->resultsReadyAt(beginIndex, endIndex);
|
||||
|
||||
if (resultAtConnected.load() <= 0)
|
||||
if (resultAtConnected.loadRelaxed() <= 0)
|
||||
break;
|
||||
|
||||
for (int i = beginIndex; i < endIndex; ++i)
|
||||
|
@ -179,7 +179,7 @@ public:
|
||||
*/
|
||||
QMutex::QMutex(RecursionMode mode)
|
||||
{
|
||||
d_ptr.store(mode == Recursive ? new QRecursiveMutexPrivate : 0);
|
||||
d_ptr.storeRelaxed(mode == Recursive ? new QRecursiveMutexPrivate : 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -189,12 +189,12 @@ QMutex::QMutex(RecursionMode mode)
|
||||
*/
|
||||
QMutex::~QMutex()
|
||||
{
|
||||
QMutexData *d = d_ptr.load();
|
||||
QMutexData *d = d_ptr.loadRelaxed();
|
||||
if (isRecursive()) {
|
||||
delete static_cast<QRecursiveMutexPrivate *>(d);
|
||||
} else if (d) {
|
||||
#ifndef QT_LINUX_FUTEX
|
||||
if (d != dummyLocked() && static_cast<QMutexPrivate *>(d)->possiblyUnlocked.load()
|
||||
if (d != dummyLocked() && static_cast<QMutexPrivate *>(d)->possiblyUnlocked.loadRelaxed()
|
||||
&& tryLock()) {
|
||||
unlock();
|
||||
return;
|
||||
@ -517,7 +517,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
}
|
||||
|
||||
QMutexPrivate *d = static_cast<QMutexPrivate *>(copy);
|
||||
if (timeout == 0 && !d->possiblyUnlocked.load())
|
||||
if (timeout == 0 && !d->possiblyUnlocked.loadRelaxed())
|
||||
return false;
|
||||
|
||||
// At this point we have a pointer to a QMutexPrivate. But the other thread
|
||||
@ -541,7 +541,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
// is set to the BigNumber magic value set in unlockInternal()
|
||||
int old_waiters;
|
||||
do {
|
||||
old_waiters = d->waiters.load();
|
||||
old_waiters = d->waiters.loadRelaxed();
|
||||
if (old_waiters == -QMutexPrivate::BigNumber) {
|
||||
// we are unlocking, and the thread that unlocks is about to change d to 0
|
||||
// we try to acquire the mutex by changing to dummyLocked()
|
||||
@ -550,7 +550,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
d->deref();
|
||||
return true;
|
||||
} else {
|
||||
Q_ASSERT(d != d_ptr.load()); //else testAndSetAcquire should have succeeded
|
||||
Q_ASSERT(d != d_ptr.loadRelaxed()); //else testAndSetAcquire should have succeeded
|
||||
// Mutex is likely to bo 0, we should continue the outer-loop,
|
||||
// set old_waiters to the magic value of BigNumber
|
||||
old_waiters = QMutexPrivate::BigNumber;
|
||||
@ -563,7 +563,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
// The mutex was unlocked before we incremented waiters.
|
||||
if (old_waiters != QMutexPrivate::BigNumber) {
|
||||
//we did not break the previous loop
|
||||
Q_ASSERT(d->waiters.load() >= 1);
|
||||
Q_ASSERT(d->waiters.loadRelaxed() >= 1);
|
||||
d->waiters.deref();
|
||||
}
|
||||
d->deref();
|
||||
@ -572,11 +572,11 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
|
||||
if (d->wait(timeout)) {
|
||||
// reset the possiblyUnlocked flag if needed (and deref its corresponding reference)
|
||||
if (d->possiblyUnlocked.load() && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
||||
if (d->possiblyUnlocked.loadRelaxed() && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
||||
d->deref();
|
||||
d->derefWaiters(1);
|
||||
//we got the lock. (do not deref)
|
||||
Q_ASSERT(d == d_ptr.load());
|
||||
Q_ASSERT(d == d_ptr.loadRelaxed());
|
||||
return true;
|
||||
} else {
|
||||
Q_ASSERT(timeout >= 0);
|
||||
@ -593,7 +593,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Q_ASSERT(d_ptr.load() != 0);
|
||||
Q_ASSERT(d_ptr.loadRelaxed() != 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -618,7 +618,7 @@ void QBasicMutex::unlockInternal() noexcept
|
||||
//there is no one waiting on this mutex anymore, set the mutex as unlocked (d = 0)
|
||||
if (d_ptr.testAndSetRelease(d, 0)) {
|
||||
// reset the possiblyUnlocked flag if needed (and deref its corresponding reference)
|
||||
if (d->possiblyUnlocked.load() && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
||||
if (d->possiblyUnlocked.loadRelaxed() && d->possiblyUnlocked.testAndSetRelaxed(true, false))
|
||||
d->deref();
|
||||
}
|
||||
d->derefWaiters(0);
|
||||
@ -657,20 +657,20 @@ QMutexPrivate *QMutexPrivate::allocate()
|
||||
int i = freelist()->next();
|
||||
QMutexPrivate *d = &(*freelist())[i];
|
||||
d->id = i;
|
||||
Q_ASSERT(d->refCount.load() == 0);
|
||||
Q_ASSERT(d->refCount.loadRelaxed() == 0);
|
||||
Q_ASSERT(!d->recursive);
|
||||
Q_ASSERT(!d->possiblyUnlocked.load());
|
||||
Q_ASSERT(d->waiters.load() == 0);
|
||||
d->refCount.store(1);
|
||||
Q_ASSERT(!d->possiblyUnlocked.loadRelaxed());
|
||||
Q_ASSERT(d->waiters.loadRelaxed() == 0);
|
||||
d->refCount.storeRelaxed(1);
|
||||
return d;
|
||||
}
|
||||
|
||||
void QMutexPrivate::release()
|
||||
{
|
||||
Q_ASSERT(!recursive);
|
||||
Q_ASSERT(refCount.load() == 0);
|
||||
Q_ASSERT(!possiblyUnlocked.load());
|
||||
Q_ASSERT(waiters.load() == 0);
|
||||
Q_ASSERT(refCount.loadRelaxed() == 0);
|
||||
Q_ASSERT(!possiblyUnlocked.loadRelaxed());
|
||||
Q_ASSERT(waiters.loadRelaxed() == 0);
|
||||
freelist()->release(id);
|
||||
}
|
||||
|
||||
@ -680,7 +680,7 @@ void QMutexPrivate::derefWaiters(int value) noexcept
|
||||
int old_waiters;
|
||||
int new_waiters;
|
||||
do {
|
||||
old_waiters = waiters.load();
|
||||
old_waiters = waiters.loadRelaxed();
|
||||
new_waiters = old_waiters;
|
||||
if (new_waiters < 0) {
|
||||
new_waiters += QMutexPrivate::BigNumber;
|
||||
@ -696,7 +696,7 @@ void QMutexPrivate::derefWaiters(int value) noexcept
|
||||
inline bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
{
|
||||
Qt::HANDLE self = QThread::currentThreadId();
|
||||
if (owner.load() == self) {
|
||||
if (owner.loadRelaxed() == self) {
|
||||
++count;
|
||||
Q_ASSERT_X(count != 0, "QMutex::lock", "Overflow in recursion counter");
|
||||
return true;
|
||||
@ -709,7 +709,7 @@ inline bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
}
|
||||
|
||||
if (success)
|
||||
owner.store(self);
|
||||
owner.storeRelaxed(self);
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@ inline void QRecursiveMutexPrivate::unlock() noexcept
|
||||
if (count > 0) {
|
||||
count--;
|
||||
} else {
|
||||
owner.store(0);
|
||||
owner.storeRelaxed(0);
|
||||
mutex.QBasicMutex::unlock();
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
|
||||
// BasicLockable concept
|
||||
inline void unlock() noexcept {
|
||||
Q_ASSERT(d_ptr.load()); //mutex must be locked
|
||||
Q_ASSERT(d_ptr.loadRelaxed()); //mutex must be locked
|
||||
if (!fastTryUnlock())
|
||||
unlockInternal();
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -
|
||||
}
|
||||
}
|
||||
|
||||
Q_ASSERT(d_ptr.load());
|
||||
Q_ASSERT(d_ptr.loadRelaxed());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ bool QBasicMutex::lockInternal(int timeout) noexcept
|
||||
|
||||
void QBasicMutex::unlockInternal() noexcept
|
||||
{
|
||||
QMutexData *d = d_ptr.load();
|
||||
QMutexData *d = d_ptr.loadRelaxed();
|
||||
Q_ASSERT(d); //we must be locked
|
||||
Q_ASSERT(d != dummyLocked()); // testAndSetRelease(dummyLocked(), 0) failed
|
||||
Q_UNUSED(d);
|
||||
|
@ -99,21 +99,21 @@ public:
|
||||
int id;
|
||||
|
||||
bool ref() {
|
||||
Q_ASSERT(refCount.load() >= 0);
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
int c;
|
||||
do {
|
||||
c = refCount.load();
|
||||
c = refCount.loadRelaxed();
|
||||
if (c == 0)
|
||||
return false;
|
||||
} while (!refCount.testAndSetRelaxed(c, c + 1));
|
||||
Q_ASSERT(refCount.load() >= 0);
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
return true;
|
||||
}
|
||||
void deref() {
|
||||
Q_ASSERT(refCount.load() >= 0);
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
if (!refCount.deref())
|
||||
release();
|
||||
Q_ASSERT(refCount.load() >= 0);
|
||||
Q_ASSERT(refCount.loadRelaxed() >= 0);
|
||||
}
|
||||
void release();
|
||||
static QMutexPrivate *allocate();
|
||||
|
@ -93,7 +93,7 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size)
|
||||
: mutexes(size), recursionMode(recursionMode)
|
||||
{
|
||||
for (int index = 0; index < mutexes.count(); ++index) {
|
||||
mutexes[index].store(0);
|
||||
mutexes[index].storeRelaxed(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size)
|
||||
QMutexPool::~QMutexPool()
|
||||
{
|
||||
for (int index = 0; index < mutexes.count(); ++index)
|
||||
delete mutexes[index].load();
|
||||
delete mutexes[index].loadRelaxed();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -131,7 +131,7 @@ QMutex *QMutexPool::createMutex(int index)
|
||||
QMutex *newMutex = new QMutex(recursionMode);
|
||||
if (!mutexes[index].testAndSetRelease(0, newMutex))
|
||||
delete newMutex;
|
||||
return mutexes[index].load();
|
||||
return mutexes[index].loadRelaxed();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
|
||||
inline QMutex *get(const void *address) {
|
||||
int index = uint(quintptr(address)) % mutexes.count();
|
||||
QMutex *m = mutexes[index].load();
|
||||
QMutex *m = mutexes[index].loadRelaxed();
|
||||
if (m)
|
||||
return m;
|
||||
else
|
||||
|
@ -143,7 +143,7 @@ inline bool isUncontendedLocked(const QReadWriteLockPrivate *d)
|
||||
QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)
|
||||
: d_ptr(recursionMode == Recursive ? new QReadWriteLockPrivate(true) : nullptr)
|
||||
{
|
||||
Q_ASSERT_X(!(quintptr(d_ptr.load()) & StateMask), "QReadWriteLock::QReadWriteLock", "bad d_ptr alignment");
|
||||
Q_ASSERT_X(!(quintptr(d_ptr.loadRelaxed()) & StateMask), "QReadWriteLock::QReadWriteLock", "bad d_ptr alignment");
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -154,7 +154,7 @@ QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)
|
||||
*/
|
||||
QReadWriteLock::~QReadWriteLock()
|
||||
{
|
||||
auto d = d_ptr.load();
|
||||
auto d = d_ptr.loadRelaxed();
|
||||
if (isUncontendedLocked(d)) {
|
||||
qWarning("QReadWriteLock: destroying locked QReadWriteLock");
|
||||
return;
|
||||
@ -263,7 +263,7 @@ bool QReadWriteLock::tryLockForRead(int timeout)
|
||||
return d->recursiveLockForRead(timeout);
|
||||
|
||||
QMutexLocker lock(&d->mutex);
|
||||
if (d != d_ptr.load()) {
|
||||
if (d != d_ptr.loadRelaxed()) {
|
||||
// d_ptr has changed: this QReadWriteLock was unlocked before we had
|
||||
// time to lock d->mutex.
|
||||
// We are holding a lock to a mutex within a QReadWriteLockPrivate
|
||||
@ -370,7 +370,7 @@ bool QReadWriteLock::tryLockForWrite(int timeout)
|
||||
return d->recursiveLockForWrite(timeout);
|
||||
|
||||
QMutexLocker lock(&d->mutex);
|
||||
if (d != d_ptr.load()) {
|
||||
if (d != d_ptr.loadRelaxed()) {
|
||||
// The mutex was unlocked before we had time to lock the mutex.
|
||||
// We are holding to a mutex within a QReadWriteLockPrivate that is already released
|
||||
// (or even is already re-used) but that's ok because the QFreeList never frees them.
|
||||
@ -433,7 +433,7 @@ void QReadWriteLock::unlock()
|
||||
if (d->waitingReaders || d->waitingWriters) {
|
||||
d->unlock();
|
||||
} else {
|
||||
Q_ASSERT(d_ptr.load() == d); // should not change when we still hold the mutex
|
||||
Q_ASSERT(d_ptr.loadRelaxed() == d); // should not change when we still hold the mutex
|
||||
d_ptr.storeRelease(nullptr);
|
||||
d->release();
|
||||
}
|
||||
@ -444,7 +444,7 @@ void QReadWriteLock::unlock()
|
||||
/*! \internal Helper for QWaitCondition::wait */
|
||||
QReadWriteLock::StateForWaitCondition QReadWriteLock::stateForWaitCondition() const
|
||||
{
|
||||
QReadWriteLockPrivate *d = d_ptr.load();
|
||||
QReadWriteLockPrivate *d = d_ptr.loadRelaxed();
|
||||
switch (quintptr(d) & StateMask) {
|
||||
case StateLockedForRead: return LockedForRead;
|
||||
case StateLockedForWrite: return LockedForWrite;
|
||||
|
@ -264,7 +264,7 @@ template <bool IsTimed> bool futexSemaphoreTryAcquire(QBasicAtomicInteger<quintp
|
||||
|
||||
if (futexHasWaiterCount) {
|
||||
// decrement the number of threads waiting
|
||||
Q_ASSERT(futexHigh32(&u)->load() & 0x7fffffffU);
|
||||
Q_ASSERT(futexHigh32(&u)->loadRelaxed() & 0x7fffffffU);
|
||||
u.fetchAndSubRelaxed(oneWaiter);
|
||||
}
|
||||
return false;
|
||||
@ -293,7 +293,7 @@ QSemaphore::QSemaphore(int n)
|
||||
quintptr nn = unsigned(n);
|
||||
if (futexHasWaiterCount)
|
||||
nn |= quint64(nn) << 32; // token count replicated in high word
|
||||
u.store(nn);
|
||||
u.storeRelaxed(nn);
|
||||
} else {
|
||||
d = new QSemaphorePrivate(n);
|
||||
}
|
||||
@ -425,7 +425,7 @@ void QSemaphore::release(int n)
|
||||
int QSemaphore::available() const
|
||||
{
|
||||
if (futexAvailable())
|
||||
return futexAvailCounter(u.load());
|
||||
return futexAvailCounter(u.loadRelaxed());
|
||||
|
||||
QMutexLocker locker(&d->mutex);
|
||||
return d->avail;
|
||||
|
@ -65,7 +65,7 @@ QThreadData::QThreadData(int initialRefCount)
|
||||
|
||||
QThreadData::~QThreadData()
|
||||
{
|
||||
Q_ASSERT(_ref.load() == 0);
|
||||
Q_ASSERT(_ref.loadRelaxed() == 0);
|
||||
|
||||
// In the odd case that Qt is running on a secondary thread, the main
|
||||
// thread instance will have been dereffed asunder because of the deref in
|
||||
@ -105,7 +105,7 @@ void QThreadData::ref()
|
||||
{
|
||||
#if QT_CONFIG(thread)
|
||||
(void) _ref.ref();
|
||||
Q_ASSERT(_ref.load() != 0);
|
||||
Q_ASSERT(_ref.loadRelaxed() != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -878,11 +878,11 @@ QThreadData *QThreadData::current(bool createIfNecessary)
|
||||
if (!data && createIfNecessary) {
|
||||
data = new QThreadData;
|
||||
data->thread = new QAdoptedThread(data);
|
||||
data->threadId.store(Qt::HANDLE(data->thread));
|
||||
data->threadId.storeRelaxed(Qt::HANDLE(data->thread));
|
||||
data->deref();
|
||||
data->isAdopted = true;
|
||||
if (!QCoreApplicationPrivate::theMainThread)
|
||||
QCoreApplicationPrivate::theMainThread = data->thread.load();
|
||||
QCoreApplicationPrivate::theMainThread = data->thread.loadRelaxed();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -925,7 +925,7 @@ QThreadPrivate::~QThreadPrivate()
|
||||
QAbstractEventDispatcher *QThread::eventDispatcher() const
|
||||
{
|
||||
Q_D(const QThread);
|
||||
return d->data->eventDispatcher.load();
|
||||
return d->data->eventDispatcher.loadRelaxed();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -257,11 +257,11 @@ public:
|
||||
void ref();
|
||||
void deref();
|
||||
inline bool hasEventDispatcher() const
|
||||
{ return eventDispatcher.load() != nullptr; }
|
||||
{ return eventDispatcher.loadRelaxed() != nullptr; }
|
||||
QAbstractEventDispatcher *createEventDispatcher();
|
||||
QAbstractEventDispatcher *ensureEventDispatcher()
|
||||
{
|
||||
QAbstractEventDispatcher *ed = eventDispatcher.load();
|
||||
QAbstractEventDispatcher *ed = eventDispatcher.loadRelaxed();
|
||||
if (Q_LIKELY(ed))
|
||||
return ed;
|
||||
return createEventDispatcher();
|
||||
|
@ -252,9 +252,9 @@ QThreadData *QThreadData::current(bool createIfNecessary)
|
||||
}
|
||||
data->deref();
|
||||
data->isAdopted = true;
|
||||
data->threadId.store(to_HANDLE(pthread_self()));
|
||||
data->threadId.storeRelaxed(to_HANDLE(pthread_self()));
|
||||
if (!QCoreApplicationPrivate::theMainThread)
|
||||
QCoreApplicationPrivate::theMainThread = data->thread.load();
|
||||
QCoreApplicationPrivate::theMainThread = data->thread.loadRelaxed();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -334,7 +334,7 @@ void *QThreadPrivate::start(void *arg)
|
||||
thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag));
|
||||
}
|
||||
|
||||
data->threadId.store(to_HANDLE(pthread_self()));
|
||||
data->threadId.storeRelaxed(to_HANDLE(pthread_self()));
|
||||
set_thread_data(data);
|
||||
|
||||
data->ref();
|
||||
@ -404,7 +404,7 @@ void QThreadPrivate::finish(void *arg)
|
||||
QThreadStorageData::finish((void **)data);
|
||||
locker.relock();
|
||||
|
||||
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.loadRelaxed();
|
||||
if (eventDispatcher) {
|
||||
d->data->eventDispatcher = 0;
|
||||
locker.unlock();
|
||||
@ -737,7 +737,7 @@ void QThread::start(Priority priority)
|
||||
#endif
|
||||
code = pthread_create(&threadId, &attr, QThreadPrivate::start, this);
|
||||
}
|
||||
d->data->threadId.store(to_HANDLE(threadId));
|
||||
d->data->threadId.storeRelaxed(to_HANDLE(threadId));
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
|
||||
@ -746,7 +746,7 @@ void QThread::start(Priority priority)
|
||||
|
||||
d->running = false;
|
||||
d->finished = false;
|
||||
d->data->threadId.store(nullptr);
|
||||
d->data->threadId.storeRelaxed(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -756,10 +756,10 @@ void QThread::terminate()
|
||||
Q_D(QThread);
|
||||
QMutexLocker locker(&d->mutex);
|
||||
|
||||
if (!d->data->threadId.load())
|
||||
if (!d->data->threadId.loadRelaxed())
|
||||
return;
|
||||
|
||||
int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId.load()));
|
||||
int code = pthread_cancel(from_HANDLE<pthread_t>(d->data->threadId.loadRelaxed()));
|
||||
if (code) {
|
||||
qErrnoWarning(code, "QThread::start: Thread termination error");
|
||||
}
|
||||
@ -771,7 +771,7 @@ bool QThread::wait(unsigned long time)
|
||||
Q_D(QThread);
|
||||
QMutexLocker locker(&d->mutex);
|
||||
|
||||
if (from_HANDLE<pthread_t>(d->data->threadId.load()) == pthread_self()) {
|
||||
if (from_HANDLE<pthread_t>(d->data->threadId.loadRelaxed()) == pthread_self()) {
|
||||
qWarning("QThread::wait: Thread tried to wait on itself");
|
||||
return false;
|
||||
}
|
||||
@ -813,7 +813,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
|
||||
int sched_policy;
|
||||
sched_param param;
|
||||
|
||||
if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId.load()), &sched_policy, ¶m) != 0) {
|
||||
if (pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId.loadRelaxed()), &sched_policy, ¶m) != 0) {
|
||||
// failed to get the scheduling policy, don't bother setting
|
||||
// the priority
|
||||
qWarning("QThread::setPriority: Cannot get scheduler parameters");
|
||||
@ -829,15 +829,15 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
|
||||
}
|
||||
|
||||
param.sched_priority = prio;
|
||||
int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId.load()), sched_policy, ¶m);
|
||||
int status = pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId.loadRelaxed()), sched_policy, ¶m);
|
||||
|
||||
# ifdef SCHED_IDLE
|
||||
// were we trying to set to idle priority and failed?
|
||||
if (status == -1 && sched_policy == SCHED_IDLE && errno == EINVAL) {
|
||||
// reset to lowest priority possible
|
||||
pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId.load()), &sched_policy, ¶m);
|
||||
pthread_getschedparam(from_HANDLE<pthread_t>(data->threadId.loadRelaxed()), &sched_policy, ¶m);
|
||||
param.sched_priority = sched_get_priority_min(sched_policy);
|
||||
pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId.load()), sched_policy, ¶m);
|
||||
pthread_setschedparam(from_HANDLE<pthread_t>(data->threadId.loadRelaxed()), sched_policy, ¶m);
|
||||
}
|
||||
# else
|
||||
Q_UNUSED(status);
|
||||
|
@ -138,11 +138,11 @@ QThreadData *QThreadData::current(bool createIfNecessary)
|
||||
}
|
||||
threadData->deref();
|
||||
threadData->isAdopted = true;
|
||||
threadData->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||
threadData->threadId.storeRelaxed(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||
|
||||
#ifndef Q_OS_WINRT
|
||||
if (!QCoreApplicationPrivate::theMainThread) {
|
||||
QCoreApplicationPrivate::theMainThread = threadData->thread.load();
|
||||
QCoreApplicationPrivate::theMainThread = threadData->thread.loadRelaxed();
|
||||
} else {
|
||||
#else
|
||||
// for winrt the main thread is set explicitly in QCoreApplication's constructor as the
|
||||
@ -184,9 +184,9 @@ void QThreadData::setMainThread()
|
||||
}
|
||||
threadData->deref();
|
||||
threadData->isAdopted = true;
|
||||
threadData->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||
threadData->threadId.storeRelaxed(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||
}
|
||||
QCoreApplicationPrivate::theMainThread = threadData->thread.load();
|
||||
QCoreApplicationPrivate::theMainThread = threadData->thread.loadRelaxed();
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -379,7 +379,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi
|
||||
|
||||
qt_create_tls();
|
||||
TlsSetValue(qt_current_thread_data_tls_index, data);
|
||||
data->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||
data->threadId.storeRelaxed(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||
|
||||
QThread::setTerminationEnabled(false);
|
||||
|
||||
@ -421,7 +421,7 @@ void QThreadPrivate::finish(void *arg, bool lockAnyway) noexcept
|
||||
QThreadStorageData::finish(tls_data);
|
||||
locker.relock();
|
||||
|
||||
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.load();
|
||||
QAbstractEventDispatcher *eventDispatcher = d->data->eventDispatcher.loadRelaxed();
|
||||
if (eventDispatcher) {
|
||||
d->data->eventDispatcher = 0;
|
||||
locker.unlock();
|
||||
|
@ -126,7 +126,7 @@ void **QThreadStorageData::get() const
|
||||
DEBUG_MSG("QThreadStorageData: Returning storage %d, data %p, for thread %p",
|
||||
id,
|
||||
*v,
|
||||
data->thread.load());
|
||||
data->thread.loadRelaxed());
|
||||
|
||||
return *v ? v : 0;
|
||||
}
|
||||
@ -148,7 +148,7 @@ void **QThreadStorageData::set(void *p)
|
||||
DEBUG_MSG("QThreadStorageData: Deleting previous storage %d, data %p, for thread %p",
|
||||
id,
|
||||
value,
|
||||
data->thread.load());
|
||||
data->thread.loadRelaxed());
|
||||
|
||||
QMutexLocker locker(&destructorsMutex);
|
||||
DestructorMap *destr = destructors();
|
||||
@ -164,7 +164,7 @@ void **QThreadStorageData::set(void *p)
|
||||
|
||||
// store new data
|
||||
value = p;
|
||||
DEBUG_MSG("QThreadStorageData: Set storage %d for thread %p to %p", id, data->thread.load(), p);
|
||||
DEBUG_MSG("QThreadStorageData: Set storage %d for thread %p to %p", id, data->thread.loadRelaxed(), p);
|
||||
return &value;
|
||||
}
|
||||
|
||||
|
@ -3181,13 +3181,13 @@ inline void QDateTime::Data::detach()
|
||||
x->m_status = QDateTimePrivate::StatusFlag(data.status & ~QDateTimePrivate::ShortData);
|
||||
x->m_msecs = data.msecs;
|
||||
} else {
|
||||
if (d->ref.load() == 1)
|
||||
if (d->ref.loadRelaxed() == 1)
|
||||
return;
|
||||
|
||||
x = new QDateTimePrivate(*d);
|
||||
}
|
||||
|
||||
x->ref.store(1);
|
||||
x->ref.storeRelaxed(1);
|
||||
if (!wasShort && !d->ref.deref())
|
||||
delete d;
|
||||
d = x;
|
||||
@ -3203,7 +3203,7 @@ inline QDateTimePrivate *QDateTime::Data::operator->()
|
||||
{
|
||||
// should we attempt to detach here?
|
||||
Q_ASSERT(!isShort());
|
||||
Q_ASSERT(d->ref.load() == 1);
|
||||
Q_ASSERT(d->ref.loadRelaxed() == 1);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -224,9 +224,9 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
|
||||
& ~(alignment - 1);
|
||||
|
||||
#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
|
||||
header->ref.atomic.store(bool(!(options & Unsharable)));
|
||||
header->ref.atomic.storeRelaxed(bool(!(options & Unsharable)));
|
||||
#else
|
||||
header->ref.atomic.store(1);
|
||||
header->ref.atomic.storeRelaxed(1);
|
||||
#endif
|
||||
header->size = 0;
|
||||
header->alloc = capacity;
|
||||
|
@ -106,7 +106,7 @@ struct QPodArrayOps
|
||||
void destroyAll() // Call from destructors, ONLY!
|
||||
{
|
||||
Q_ASSERT(this->isMutable());
|
||||
Q_ASSERT(this->ref.atomic.load() == 0);
|
||||
Q_ASSERT(this->ref.atomic.loadRelaxed() == 0);
|
||||
|
||||
// As this is to be called only from destructor, it doesn't need to be
|
||||
// exception safe; size not updated.
|
||||
@ -204,7 +204,7 @@ struct QGenericArrayOps
|
||||
// As this is to be called only from destructor, it doesn't need to be
|
||||
// exception safe; size not updated.
|
||||
|
||||
Q_ASSERT(this->ref.atomic.load() == 0);
|
||||
Q_ASSERT(this->ref.atomic.loadRelaxed() == 0);
|
||||
|
||||
const T *const b = this->begin();
|
||||
const T *i = this->end();
|
||||
|
@ -166,7 +166,7 @@ QCollator &QCollator::operator=(const QCollator &other)
|
||||
*/
|
||||
void QCollator::detach()
|
||||
{
|
||||
if (d->ref.load() != 1) {
|
||||
if (d->ref.loadRelaxed() != 1) {
|
||||
QCollatorPrivate *x = new QCollatorPrivate(d->locale);
|
||||
if (!d->ref.deref())
|
||||
delete d;
|
||||
|
@ -100,8 +100,8 @@ public:
|
||||
|
||||
inline ~QContiguousCache() { if (!d) return; if (!d->ref.deref()) freeData(p); }
|
||||
|
||||
inline void detach() { if (d->ref.load() != 1) detach_helper(); }
|
||||
inline bool isDetached() const { return d->ref.load() == 1; }
|
||||
inline void detach() { if (d->ref.loadRelaxed() != 1) detach_helper(); }
|
||||
inline bool isDetached() const { return d->ref.loadRelaxed() == 1; }
|
||||
#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
|
||||
inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; }
|
||||
#endif
|
||||
@ -176,7 +176,7 @@ void QContiguousCache<T>::detach_helper()
|
||||
union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x;
|
||||
|
||||
x.d = allocateData(d->alloc);
|
||||
x.d->ref.store(1);
|
||||
x.d->ref.storeRelaxed(1);
|
||||
x.d->count = d->count;
|
||||
x.d->start = d->start;
|
||||
x.d->offset = d->offset;
|
||||
@ -215,7 +215,7 @@ void QContiguousCache<T>::setCapacity(int asize)
|
||||
detach();
|
||||
union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x;
|
||||
x.d = allocateData(asize);
|
||||
x.d->ref.store(1);
|
||||
x.d->ref.storeRelaxed(1);
|
||||
x.d->alloc = asize;
|
||||
x.d->count = qMin(d->count, asize);
|
||||
x.d->offset = d->offset + d->count - x.d->count;
|
||||
@ -251,7 +251,7 @@ void QContiguousCache<T>::setCapacity(int asize)
|
||||
template <typename T>
|
||||
void QContiguousCache<T>::clear()
|
||||
{
|
||||
if (d->ref.load() == 1) {
|
||||
if (d->ref.loadRelaxed() == 1) {
|
||||
if (QTypeInfo<T>::isComplex) {
|
||||
int oldcount = d->count;
|
||||
T * i = p->array + d->start;
|
||||
@ -267,7 +267,7 @@ void QContiguousCache<T>::clear()
|
||||
} else {
|
||||
union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x;
|
||||
x.d = allocateData(d->alloc);
|
||||
x.d->ref.store(1);
|
||||
x.d->ref.storeRelaxed(1);
|
||||
x.d->alloc = d->alloc;
|
||||
x.d->count = x.d->start = x.d->offset = 0;
|
||||
x.d->sharable = true;
|
||||
@ -287,7 +287,7 @@ QContiguousCache<T>::QContiguousCache(int cap)
|
||||
{
|
||||
Q_ASSERT(cap >= 0);
|
||||
d = allocateData(cap);
|
||||
d->ref.store(1);
|
||||
d->ref.storeRelaxed(1);
|
||||
d->alloc = cap;
|
||||
d->count = d->start = d->offset = 0;
|
||||
d->sharable = true;
|
||||
|
@ -171,7 +171,7 @@ class QFreeList
|
||||
// qDebug("QFreeList: allocating %d elements (%ld bytes) with offset %d", size, size * sizeof(ElementType), offset);
|
||||
ElementType *v = new ElementType[size];
|
||||
for (int i = 0; i < size; ++i)
|
||||
v[i].next.store(offset + i + 1);
|
||||
v[i].next.storeRelaxed(offset + i + 1);
|
||||
return v;
|
||||
}
|
||||
|
||||
@ -218,21 +218,21 @@ template <typename T, typename ConstantsType>
|
||||
inline QFreeList<T, ConstantsType>::~QFreeList()
|
||||
{
|
||||
for (int i = 0; i < ConstantsType::BlockCount; ++i)
|
||||
delete [] _v[i].load();
|
||||
delete [] _v[i].loadRelaxed();
|
||||
}
|
||||
|
||||
template <typename T, typename ConstantsType>
|
||||
inline typename QFreeList<T, ConstantsType>::ConstReferenceType QFreeList<T, ConstantsType>::at(int x) const
|
||||
{
|
||||
const int block = blockfor(x);
|
||||
return (_v[block].load())[x].t();
|
||||
return (_v[block].loadRelaxed())[x].t();
|
||||
}
|
||||
|
||||
template <typename T, typename ConstantsType>
|
||||
inline typename QFreeList<T, ConstantsType>::ReferenceType QFreeList<T, ConstantsType>::operator[](int x)
|
||||
{
|
||||
const int block = blockfor(x);
|
||||
return (_v[block].load())[x].t();
|
||||
return (_v[block].loadRelaxed())[x].t();
|
||||
}
|
||||
|
||||
template <typename T, typename ConstantsType>
|
||||
@ -257,7 +257,7 @@ inline int QFreeList<T, ConstantsType>::next()
|
||||
}
|
||||
}
|
||||
|
||||
newid = v[at].next.load() | (id & ~ConstantsType::IndexMask);
|
||||
newid = v[at].next.loadRelaxed() | (id & ~ConstantsType::IndexMask);
|
||||
} while (!_next.testAndSetRelease(id, newid));
|
||||
// qDebug("QFreeList::next(): returning %d (_next now %d, serial %d)",
|
||||
// id & ConstantsType::IndexMask,
|
||||
@ -271,12 +271,12 @@ inline void QFreeList<T, ConstantsType>::release(int id)
|
||||
{
|
||||
int at = id & ConstantsType::IndexMask;
|
||||
const int block = blockfor(at);
|
||||
ElementType *v = _v[block].load();
|
||||
ElementType *v = _v[block].loadRelaxed();
|
||||
|
||||
int x, newid;
|
||||
do {
|
||||
x = _next.loadAcquire();
|
||||
v[at].next.store(x & ConstantsType::IndexMask);
|
||||
v[at].next.storeRelaxed(x & ConstantsType::IndexMask);
|
||||
|
||||
newid = incrementserial(x, id);
|
||||
} while (!_next.testAndSetRelease(x, newid));
|
||||
|
@ -321,7 +321,7 @@ static QBasicAtomicInt qt_qhash_seed = Q_BASIC_ATOMIC_INITIALIZER(-1);
|
||||
*/
|
||||
static void qt_initialize_qhash_seed()
|
||||
{
|
||||
if (qt_qhash_seed.load() == -1) {
|
||||
if (qt_qhash_seed.loadRelaxed() == -1) {
|
||||
int x(qt_create_qhash_seed() & INT_MAX);
|
||||
qt_qhash_seed.testAndSetRelaxed(-1, x);
|
||||
}
|
||||
@ -340,7 +340,7 @@ static void qt_initialize_qhash_seed()
|
||||
int qGlobalQHashSeed()
|
||||
{
|
||||
qt_initialize_qhash_seed();
|
||||
return qt_qhash_seed.load();
|
||||
return qt_qhash_seed.loadRelaxed();
|
||||
}
|
||||
|
||||
/*! \relates QHash
|
||||
@ -372,14 +372,14 @@ void qSetGlobalQHashSeed(int newSeed)
|
||||
return;
|
||||
if (newSeed == -1) {
|
||||
int x(qt_create_qhash_seed() & INT_MAX);
|
||||
qt_qhash_seed.store(x);
|
||||
qt_qhash_seed.storeRelaxed(x);
|
||||
} else {
|
||||
if (newSeed) {
|
||||
// can't use qWarning here (reentrancy)
|
||||
fprintf(stderr, "qSetGlobalQHashSeed: forced seed value is not 0, cannot guarantee that the "
|
||||
"hashing functions will produce a stable value.");
|
||||
}
|
||||
qt_qhash_seed.store(newSeed & INT_MAX);
|
||||
qt_qhash_seed.storeRelaxed(newSeed & INT_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *),
|
||||
d->userNumBits = userNumBits;
|
||||
d->numBits = numBits;
|
||||
d->numBuckets = numBuckets;
|
||||
d->seed = (this == &shared_null) ? uint(qt_qhash_seed.load()) : seed;
|
||||
d->seed = (this == &shared_null) ? uint(qt_qhash_seed.loadRelaxed()) : seed;
|
||||
d->sharable = true;
|
||||
d->strictAlignment = nodeAlign > 8;
|
||||
d->reserved = 0;
|
||||
|
@ -340,7 +340,7 @@ void QLinkedList<T>::freeData(QLinkedListData *x)
|
||||
{
|
||||
Node *y = reinterpret_cast<Node*>(x);
|
||||
Node *i = y->n;
|
||||
Q_ASSERT(x->ref.atomic.load() == 0);
|
||||
Q_ASSERT(x->ref.atomic.loadRelaxed() == 0);
|
||||
while (i != y) {
|
||||
Node *n = i;
|
||||
i = i->n;
|
||||
|
@ -337,7 +337,7 @@ public:
|
||||
{
|
||||
QLocalePrivate *retval = new QLocalePrivate;
|
||||
retval->m_data = data;
|
||||
retval->ref.store(0);
|
||||
retval->ref.storeRelaxed(0);
|
||||
retval->m_numberOptions = numberOptions;
|
||||
return retval;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class RefCount
|
||||
{
|
||||
public:
|
||||
inline bool ref() noexcept {
|
||||
int count = atomic.load();
|
||||
int count = atomic.loadRelaxed();
|
||||
#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
|
||||
if (count == 0) // !isSharable
|
||||
return false;
|
||||
@ -63,7 +63,7 @@ public:
|
||||
}
|
||||
|
||||
inline bool deref() noexcept {
|
||||
int count = atomic.load();
|
||||
int count = atomic.loadRelaxed();
|
||||
#if !defined(QT_NO_UNSHARABLE_CONTAINERS)
|
||||
if (count == 0) // !isSharable
|
||||
return false;
|
||||
@ -86,24 +86,24 @@ public:
|
||||
bool isSharable() const noexcept
|
||||
{
|
||||
// Sharable === Shared ownership.
|
||||
return atomic.load() != 0;
|
||||
return atomic.loadRelaxed() != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isStatic() const noexcept
|
||||
{
|
||||
// Persistent object, never deleted
|
||||
return atomic.load() == -1;
|
||||
return atomic.loadRelaxed() == -1;
|
||||
}
|
||||
|
||||
bool isShared() const noexcept
|
||||
{
|
||||
int count = atomic.load();
|
||||
int count = atomic.loadRelaxed();
|
||||
return (count != 1) && (count != 0);
|
||||
}
|
||||
|
||||
void initializeOwned() noexcept { atomic.store(1); }
|
||||
void initializeUnsharable() noexcept { atomic.store(0); }
|
||||
void initializeOwned() noexcept { atomic.storeRelaxed(1); }
|
||||
void initializeUnsharable() noexcept { atomic.storeRelaxed(0); }
|
||||
|
||||
QBasicAtomicInt atomic;
|
||||
};
|
||||
|
@ -1707,7 +1707,7 @@ void QRegExpEngine::dump() const
|
||||
|
||||
void QRegExpEngine::setup()
|
||||
{
|
||||
ref.store(1);
|
||||
ref.storeRelaxed(1);
|
||||
#ifndef QT_NO_REGEXP_CAPTURE
|
||||
f.resize(32);
|
||||
nf = 0;
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
typedef T Type;
|
||||
typedef T *pointer;
|
||||
|
||||
inline void detach() { if (d && d->ref.load() != 1) detach_helper(); }
|
||||
inline void detach() { if (d && d->ref.loadRelaxed() != 1) detach_helper(); }
|
||||
inline T &operator*() { detach(); return *d; }
|
||||
inline const T &operator*() const { return *d; }
|
||||
inline T *operator->() { detach(); return d; }
|
||||
@ -163,7 +163,7 @@ public:
|
||||
inline const T *constData() const { return d; }
|
||||
inline T *take() { T *x = d; d = nullptr; return x; }
|
||||
|
||||
inline void detach() { if (d && d->ref.load() != 1) detach_helper(); }
|
||||
inline void detach() { if (d && d->ref.loadRelaxed() != 1) detach_helper(); }
|
||||
|
||||
inline void reset()
|
||||
{
|
||||
|
@ -1380,7 +1380,7 @@ void QtSharedPointer::ExternalRefCountData::setQObjectShared(const QObject *, bo
|
||||
*/
|
||||
void QtSharedPointer::ExternalRefCountData::checkQObjectShared(const QObject *)
|
||||
{
|
||||
if (strongref.load() < 0)
|
||||
if (strongref.loadRelaxed() < 0)
|
||||
qWarning("QSharedPointer: cannot create a QSharedPointer from a QObject-tracking QWeakPointer");
|
||||
}
|
||||
|
||||
@ -1390,7 +1390,7 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
||||
QObjectPrivate *d = QObjectPrivate::get(const_cast<QObject *>(obj));
|
||||
Q_ASSERT_X(!d->wasDeleted, "QWeakPointer", "Detected QWeakPointer creation in a QObject being deleted");
|
||||
|
||||
ExternalRefCountData *that = d->sharedRefcount.load();
|
||||
ExternalRefCountData *that = d->sharedRefcount.loadRelaxed();
|
||||
if (that) {
|
||||
that->weakref.ref();
|
||||
return that;
|
||||
@ -1398,8 +1398,8 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
||||
|
||||
// we can create the refcount data because it doesn't exist
|
||||
ExternalRefCountData *x = new ExternalRefCountData(Qt::Uninitialized);
|
||||
x->strongref.store(-1);
|
||||
x->weakref.store(2); // the QWeakPointer that called us plus the QObject itself
|
||||
x->strongref.storeRelaxed(-1);
|
||||
x->weakref.storeRelaxed(2); // the QWeakPointer that called us plus the QObject itself
|
||||
|
||||
ExternalRefCountData *ret;
|
||||
if (d->sharedRefcount.testAndSetOrdered(nullptr, x, ret)) { // ought to be release+acquire; this is acq_rel+acquire
|
||||
@ -1407,7 +1407,7 @@ QtSharedPointer::ExternalRefCountData *QtSharedPointer::ExternalRefCountData::ge
|
||||
} else {
|
||||
// ~ExternalRefCountData has a Q_ASSERT, so we use this trick to
|
||||
// only execute this if Q_ASSERTs are enabled
|
||||
Q_ASSERT((x->weakref.store(0), true));
|
||||
Q_ASSERT((x->weakref.storeRelaxed(0), true));
|
||||
delete x;
|
||||
ret->weakref.ref();
|
||||
}
|
||||
|
@ -154,11 +154,11 @@ namespace QtSharedPointer {
|
||||
inline ExternalRefCountData(DestroyerFn d)
|
||||
: destroyer(d)
|
||||
{
|
||||
strongref.store(1);
|
||||
weakref.store(1);
|
||||
strongref.storeRelaxed(1);
|
||||
weakref.storeRelaxed(1);
|
||||
}
|
||||
inline ExternalRefCountData(Qt::Initialization) { }
|
||||
~ExternalRefCountData() { Q_ASSERT(!weakref.load()); Q_ASSERT(strongref.load() <= 0); }
|
||||
~ExternalRefCountData() { Q_ASSERT(!weakref.loadRelaxed()); Q_ASSERT(strongref.loadRelaxed() <= 0); }
|
||||
|
||||
void destroy() { destroyer(this); }
|
||||
|
||||
@ -522,12 +522,12 @@ public:
|
||||
if (o) {
|
||||
// increase the strongref, but never up from zero
|
||||
// or less (-1 is used by QWeakPointer on untracked QObject)
|
||||
int tmp = o->strongref.load();
|
||||
int tmp = o->strongref.loadRelaxed();
|
||||
while (tmp > 0) {
|
||||
// try to increment from "tmp" to "tmp + 1"
|
||||
if (o->strongref.testAndSetRelaxed(tmp, tmp + 1))
|
||||
break; // succeeded
|
||||
tmp = o->strongref.load(); // failed, try again
|
||||
tmp = o->strongref.loadRelaxed(); // failed, try again
|
||||
}
|
||||
|
||||
if (tmp > 0) {
|
||||
@ -540,7 +540,7 @@ public:
|
||||
|
||||
qSwap(d, o);
|
||||
qSwap(this->value, actual);
|
||||
if (!d || d->strongref.load() == 0)
|
||||
if (!d || d->strongref.loadRelaxed() == 0)
|
||||
this->value = nullptr;
|
||||
|
||||
// dereference saved data
|
||||
@ -566,7 +566,7 @@ public:
|
||||
typedef const value_type &const_reference;
|
||||
typedef qptrdiff difference_type;
|
||||
|
||||
bool isNull() const noexcept { return d == nullptr || d->strongref.load() == 0 || value == nullptr; }
|
||||
bool isNull() const noexcept { return d == nullptr || d->strongref.loadRelaxed() == 0 || value == nullptr; }
|
||||
operator RestrictedBool() const noexcept { return isNull() ? nullptr : &QWeakPointer::value; }
|
||||
bool operator !() const noexcept { return isNull(); }
|
||||
|
||||
@ -709,7 +709,7 @@ public:
|
||||
// a weak pointer's data but the weak pointer itself
|
||||
inline T *internalData() const noexcept
|
||||
{
|
||||
return d == nullptr || d->strongref.load() == 0 ? nullptr : value;
|
||||
return d == nullptr || d->strongref.loadRelaxed() == 0 ? nullptr : value;
|
||||
}
|
||||
|
||||
Data *d;
|
||||
|
@ -563,9 +563,9 @@ quint64 qDetectCpuFeatures()
|
||||
features_string + features_indices[qCountTrailingZeroBits(missing)]);
|
||||
}
|
||||
|
||||
qt_cpu_features[0].store(f | quint32(QSimdInitialized));
|
||||
qt_cpu_features[0].storeRelaxed(f | quint32(QSimdInitialized));
|
||||
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
|
||||
qt_cpu_features[1].store(f >> 32);
|
||||
qt_cpu_features[1].storeRelaxed(f >> 32);
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
@ -348,9 +348,9 @@ Q_CORE_EXPORT quint64 qDetectCpuFeatures();
|
||||
|
||||
static inline quint64 qCpuFeatures()
|
||||
{
|
||||
quint64 features = qt_cpu_features[0].load();
|
||||
quint64 features = qt_cpu_features[0].loadRelaxed();
|
||||
#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
|
||||
features |= quint64(qt_cpu_features[1].load()) << 32;
|
||||
features |= quint64(qt_cpu_features[1].loadRelaxed()) << 32;
|
||||
#endif
|
||||
if (Q_UNLIKELY(features == 0)) {
|
||||
features = qDetectCpuFeatures();
|
||||
|
@ -111,7 +111,7 @@ bool QDBusArgumentPrivate::checkWrite(QDBusArgumentPrivate *&d)
|
||||
if (!d->marshaller()->ok)
|
||||
return false;
|
||||
|
||||
if (d->message && d->ref.load() != 1) {
|
||||
if (d->message && d->ref.loadRelaxed() != 1) {
|
||||
QDBusMarshaller *dd = new QDBusMarshaller(d->capabilities);
|
||||
dd->message = q_dbus_message_copy(d->message);
|
||||
q_dbus_message_iter_init_append(dd->message, &dd->iterator);
|
||||
@ -152,7 +152,7 @@ bool QDBusArgumentPrivate::checkReadAndDetach(QDBusArgumentPrivate *&d)
|
||||
if (!checkRead(d))
|
||||
return false; // don't bother
|
||||
|
||||
if (d->ref.load() == 1)
|
||||
if (d->ref.loadRelaxed() == 1)
|
||||
return true; // no need to detach
|
||||
|
||||
QDBusDemarshaller *dd = new QDBusDemarshaller(d->capabilities);
|
||||
|
@ -534,7 +534,7 @@ qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
|
||||
|
||||
bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
|
||||
{
|
||||
if (!ref.load())
|
||||
if (!ref.loadRelaxed())
|
||||
return false;
|
||||
|
||||
// local message are always delivered, regardless of filtering
|
||||
@ -1077,7 +1077,7 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
|
||||
if (lastMode == ClientMode || lastMode == PeerMode) {
|
||||
// the bus service object holds a reference back to us;
|
||||
// we need to destroy it before we finish destroying ourselves
|
||||
Q_ASSERT(ref.load() == 0);
|
||||
Q_ASSERT(ref.loadRelaxed() == 0);
|
||||
QObject *obj = (QObject *)busService;
|
||||
if (obj) {
|
||||
disconnect(obj, nullptr, this, nullptr);
|
||||
@ -2126,11 +2126,11 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM
|
||||
|
||||
if ((receiver && returnMethod) || errorMethod) {
|
||||
// no one waiting, will delete pcall in processFinishedCall()
|
||||
pcall->ref.store(1);
|
||||
pcall->ref.storeRelaxed(1);
|
||||
} else {
|
||||
// set double ref to prevent race between processFinishedCall() and ref counting
|
||||
// by QDBusPendingCall::QExplicitlySharedDataPointer<QDBusPendingCallPrivate>
|
||||
pcall->ref.store(2);
|
||||
pcall->ref.storeRelaxed(2);
|
||||
}
|
||||
|
||||
if (isLoopback) {
|
||||
|
@ -93,7 +93,7 @@ void QDBusMetaTypeId::init()
|
||||
|
||||
// reentrancy is not a problem since everything else is locked on their own
|
||||
// set the guard variable at the end
|
||||
if (!initialized.load()) {
|
||||
if (!initialized.loadRelaxed()) {
|
||||
// register our types with Qt Core (calling qMetaTypeId<T>() does this implicitly)
|
||||
(void)message();
|
||||
(void)argument();
|
||||
@ -145,7 +145,7 @@ void QDBusMetaTypeId::init()
|
||||
qDBusRegisterMetaType<QVector<QDBusUnixFileDescriptor> >();
|
||||
#endif
|
||||
|
||||
initialized.store(true);
|
||||
initialized.storeRelaxed(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,7 +473,7 @@ QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg)
|
||||
msg.type() == QDBusMessage::ReplyMessage) {
|
||||
d = new QDBusPendingCallPrivate(QDBusMessage(), 0);
|
||||
d->replyMessage = msg;
|
||||
d->ref.store(1);
|
||||
d->ref.storeRelaxed(1);
|
||||
}
|
||||
|
||||
return QDBusPendingCall(d);
|
||||
|
@ -117,7 +117,7 @@ QDBusServer::~QDBusServer()
|
||||
d->serverConnectionNames.clear();
|
||||
}
|
||||
d->serverObject = nullptr;
|
||||
d->ref.store(0);
|
||||
d->ref.storeRelaxed(0);
|
||||
d->deleteLater();
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ QDBusUnixFileDescriptor::~QDBusUnixFileDescriptor()
|
||||
*/
|
||||
bool QDBusUnixFileDescriptor::isValid() const
|
||||
{
|
||||
return d ? d->fd.load() != -1 : false;
|
||||
return d ? d->fd.loadRelaxed() != -1 : false;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -226,7 +226,7 @@ bool QDBusUnixFileDescriptor::isValid() const
|
||||
*/
|
||||
int QDBusUnixFileDescriptor::fileDescriptor() const
|
||||
{
|
||||
return d ? d->fd.load() : -1;
|
||||
return d ? d->fd.loadRelaxed() : -1;
|
||||
}
|
||||
|
||||
// actual implementation
|
||||
@ -283,12 +283,12 @@ void QDBusUnixFileDescriptor::giveFileDescriptor(int fileDescriptor)
|
||||
else
|
||||
d = new QDBusUnixFileDescriptorPrivate;
|
||||
|
||||
const int fdl = d->fd.load();
|
||||
const int fdl = d->fd.loadRelaxed();
|
||||
if (fdl != -1)
|
||||
qt_safe_close(fdl);
|
||||
|
||||
if (fileDescriptor != -1)
|
||||
d->fd.store(fileDescriptor);
|
||||
d->fd.storeRelaxed(fileDescriptor);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -309,7 +309,7 @@ int QDBusUnixFileDescriptor::takeFileDescriptor()
|
||||
|
||||
QDBusUnixFileDescriptorPrivate::~QDBusUnixFileDescriptorPrivate()
|
||||
{
|
||||
const int fdl = fd.load();
|
||||
const int fdl = fd.loadRelaxed();
|
||||
if (fdl != -1)
|
||||
qt_safe_close(fdl);
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ bool QIcon::isNull() const
|
||||
*/
|
||||
bool QIcon::isDetached() const
|
||||
{
|
||||
return !d || d->ref.load() == 1;
|
||||
return !d || d->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@ -1000,7 +1000,7 @@ void QIcon::detach()
|
||||
delete d;
|
||||
d = 0;
|
||||
return;
|
||||
} else if (d->ref.load() != 1) {
|
||||
} else if (d->ref.loadRelaxed() != 1) {
|
||||
QIconPrivate *x = new QIconPrivate(d->engine->clone());
|
||||
if (!d->ref.deref())
|
||||
delete d;
|
||||
|
@ -1082,10 +1082,10 @@ QImage::operator QVariant() const
|
||||
void QImage::detach()
|
||||
{
|
||||
if (d) {
|
||||
if (d->is_cached && d->ref.load() == 1)
|
||||
if (d->is_cached && d->ref.loadRelaxed() == 1)
|
||||
QImagePixmapCleanupHooks::executeImageHooks(cacheKey());
|
||||
|
||||
if (d->ref.load() != 1 || d->ro_data)
|
||||
if (d->ref.loadRelaxed() != 1 || d->ro_data)
|
||||
*this = copy();
|
||||
|
||||
if (d)
|
||||
@ -4422,7 +4422,7 @@ qint64 QImage::cacheKey() const
|
||||
|
||||
bool QImage::isDetached() const
|
||||
{
|
||||
return d && d->ref.load() == 1;
|
||||
return d && d->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
|
||||
@ -5087,7 +5087,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
|
||||
return true;
|
||||
|
||||
// No in-place conversion if we have to detach
|
||||
if (ref.load() > 1 || !own_data)
|
||||
if (ref.loadRelaxed() > 1 || !own_data)
|
||||
return false;
|
||||
|
||||
InPlace_Image_Converter converter = qimage_inplace_converter_map[format][newFormat];
|
||||
|
@ -235,7 +235,7 @@ void QPicture::detach()
|
||||
|
||||
bool QPicture::isDetached() const
|
||||
{
|
||||
return d_func()->ref.load() == 1;
|
||||
return d_func()->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -262,7 +262,7 @@ QPixmap::QPixmap(const char * const xpm[])
|
||||
|
||||
QPixmap::~QPixmap()
|
||||
{
|
||||
Q_ASSERT(!data || data->ref.load() >= 1); // Catch if ref-counting changes again
|
||||
Q_ASSERT(!data || data->ref.loadRelaxed() >= 1); // Catch if ref-counting changes again
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -910,7 +910,7 @@ void QPixmap::fill(const QColor &color)
|
||||
return;
|
||||
}
|
||||
|
||||
if (data->ref.load() == 1) {
|
||||
if (data->ref.loadRelaxed() == 1) {
|
||||
// detach() will also remove this pixmap from caches, so
|
||||
// it has to be called even when ref == 1.
|
||||
detach();
|
||||
@ -1053,7 +1053,7 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap)
|
||||
|
||||
bool QPixmap::isDetached() const
|
||||
{
|
||||
return data && data->ref.load() == 1;
|
||||
return data && data->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1523,10 +1523,10 @@ void QPixmap::detach()
|
||||
rasterData->image.detach();
|
||||
}
|
||||
|
||||
if (data->is_cached && data->ref.load() == 1)
|
||||
if (data->is_cached && data->ref.loadRelaxed() == 1)
|
||||
QImagePixmapCleanupHooks::executePlatformPixmapModificationHooks(data.data());
|
||||
|
||||
if (data->ref.load() != 1) {
|
||||
if (data->ref.loadRelaxed() != 1) {
|
||||
*this = copy();
|
||||
}
|
||||
++data->detach_no;
|
||||
|
@ -4921,7 +4921,7 @@ QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setId(int id)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->id = id;
|
||||
}
|
||||
@ -4929,7 +4929,7 @@ void QTouchEvent::TouchPoint::setId(int id)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setUniqueId(qint64 uid)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->uniqueId = QPointingDeviceUniqueId::fromNumericId(uid);
|
||||
}
|
||||
@ -4937,7 +4937,7 @@ void QTouchEvent::TouchPoint::setUniqueId(qint64 uid)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->state = state;
|
||||
}
|
||||
@ -4945,7 +4945,7 @@ void QTouchEvent::TouchPoint::setState(Qt::TouchPointStates state)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->pos = pos;
|
||||
}
|
||||
@ -4953,7 +4953,7 @@ void QTouchEvent::TouchPoint::setPos(const QPointF &pos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->scenePos = scenePos;
|
||||
}
|
||||
@ -4961,7 +4961,7 @@ void QTouchEvent::TouchPoint::setScenePos(const QPointF &scenePos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->screenPos = screenPos;
|
||||
}
|
||||
@ -4969,7 +4969,7 @@ void QTouchEvent::TouchPoint::setScreenPos(const QPointF &screenPos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->normalizedPos = normalizedPos;
|
||||
}
|
||||
@ -4977,7 +4977,7 @@ void QTouchEvent::TouchPoint::setNormalizedPos(const QPointF &normalizedPos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->startPos = startPos;
|
||||
}
|
||||
@ -4985,7 +4985,7 @@ void QTouchEvent::TouchPoint::setStartPos(const QPointF &startPos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->startScenePos = startScenePos;
|
||||
}
|
||||
@ -4993,7 +4993,7 @@ void QTouchEvent::TouchPoint::setStartScenePos(const QPointF &startScenePos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->startScreenPos = startScreenPos;
|
||||
}
|
||||
@ -5001,7 +5001,7 @@ void QTouchEvent::TouchPoint::setStartScreenPos(const QPointF &startScreenPos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormalizedPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->startNormalizedPos = startNormalizedPos;
|
||||
}
|
||||
@ -5009,7 +5009,7 @@ void QTouchEvent::TouchPoint::setStartNormalizedPos(const QPointF &startNormaliz
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->lastPos = lastPos;
|
||||
}
|
||||
@ -5017,7 +5017,7 @@ void QTouchEvent::TouchPoint::setLastPos(const QPointF &lastPos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->lastScenePos = lastScenePos;
|
||||
}
|
||||
@ -5025,7 +5025,7 @@ void QTouchEvent::TouchPoint::setLastScenePos(const QPointF &lastScenePos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->lastScreenPos = lastScreenPos;
|
||||
}
|
||||
@ -5033,7 +5033,7 @@ void QTouchEvent::TouchPoint::setLastScreenPos(const QPointF &lastScreenPos)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalizedPos)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->lastNormalizedPos = lastNormalizedPos;
|
||||
}
|
||||
@ -5044,7 +5044,7 @@ void QTouchEvent::TouchPoint::setLastNormalizedPos(const QPointF &lastNormalized
|
||||
*/
|
||||
void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->pos = rect.center();
|
||||
d->ellipseDiameters = rect.size();
|
||||
@ -5055,7 +5055,7 @@ void QTouchEvent::TouchPoint::setRect(const QRectF &rect)
|
||||
*/
|
||||
void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->scenePos = sceneRect.center();
|
||||
d->ellipseDiameters = sceneRect.size();
|
||||
@ -5066,7 +5066,7 @@ void QTouchEvent::TouchPoint::setSceneRect(const QRectF &sceneRect)
|
||||
*/
|
||||
void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->screenPos = screenRect.center();
|
||||
d->ellipseDiameters = screenRect.size();
|
||||
@ -5075,7 +5075,7 @@ void QTouchEvent::TouchPoint::setScreenRect(const QRectF &screenRect)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setPressure(qreal pressure)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->pressure = pressure;
|
||||
}
|
||||
@ -5083,7 +5083,7 @@ void QTouchEvent::TouchPoint::setPressure(qreal pressure)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setRotation(qreal angle)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->rotation = angle;
|
||||
}
|
||||
@ -5091,7 +5091,7 @@ void QTouchEvent::TouchPoint::setRotation(qreal angle)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setEllipseDiameters(const QSizeF &dia)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->ellipseDiameters = dia;
|
||||
}
|
||||
@ -5099,7 +5099,7 @@ void QTouchEvent::TouchPoint::setEllipseDiameters(const QSizeF &dia)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->velocity = v;
|
||||
}
|
||||
@ -5107,7 +5107,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
|
||||
/*! \internal */
|
||||
void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->rawScreenPositions = positions;
|
||||
}
|
||||
@ -5117,7 +5117,7 @@ void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &posi
|
||||
*/
|
||||
void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
|
||||
{
|
||||
if (d->ref.load() != 1)
|
||||
if (d->ref.loadRelaxed() != 1)
|
||||
d = d->detach();
|
||||
d->flags = flags;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
inline QTouchEventTouchPointPrivate *detach()
|
||||
{
|
||||
QTouchEventTouchPointPrivate *d = new QTouchEventTouchPointPrivate(*this);
|
||||
d->ref.store(1);
|
||||
d->ref.storeRelaxed(1);
|
||||
if (!this->ref.deref())
|
||||
delete this;
|
||||
return d;
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
static QAbstractEventDispatcher *qt_qpa_core_dispatcher()
|
||||
{
|
||||
if (QCoreApplication::instance())
|
||||
return QCoreApplication::instance()->d_func()->threadData->eventDispatcher.load();
|
||||
return QCoreApplication::instance()->d_func()->threadData->eventDispatcher.loadRelaxed();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1518,7 +1518,7 @@ bool QKeySequence::operator< (const QKeySequence &other) const
|
||||
*/
|
||||
bool QKeySequence::isDetached() const
|
||||
{
|
||||
return d->ref.load() == 1;
|
||||
return d->ref.loadRelaxed() == 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1634,7 +1634,7 @@ QOpenGLMultiGroupSharedResource::~QOpenGLMultiGroupSharedResource()
|
||||
active.deref();
|
||||
}
|
||||
#ifndef QT_NO_DEBUG
|
||||
if (active.load() != 0) {
|
||||
if (active.loadRelaxed() != 0) {
|
||||
qWarning("QtGui: Resources are still available at program shutdown.\n"
|
||||
" This is possibly caused by a leaked QOpenGLWidget, \n"
|
||||
" QOpenGLFramebufferObject or QOpenGLPixelBuffer.");
|
||||
|
@ -830,7 +830,7 @@ bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const
|
||||
*/
|
||||
void QPalette::detach()
|
||||
{
|
||||
if (d->ref.load() != 1) {
|
||||
if (d->ref.loadRelaxed() != 1) {
|
||||
QPalettePrivate *x = new QPalettePrivate;
|
||||
for(int grp = 0; grp < (int)NColorGroups; grp++) {
|
||||
for(int role = 0; role < (int)NColorRoles; role++)
|
||||
|
@ -246,7 +246,7 @@ QSurfaceFormat::QSurfaceFormat(QSurfaceFormat::FormatOptions options) :
|
||||
*/
|
||||
void QSurfaceFormat::detach()
|
||||
{
|
||||
if (d->ref.load() != 1) {
|
||||
if (d->ref.loadRelaxed() != 1) {
|
||||
QSurfaceFormatPrivate *newd = new QSurfaceFormatPrivate(d);
|
||||
if (!d->ref.deref())
|
||||
delete d;
|
||||
|
@ -1115,7 +1115,7 @@ bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFl
|
||||
} else {
|
||||
sendWindowSystemEvents(flags);
|
||||
}
|
||||
return QWindowSystemInterfacePrivate::eventAccepted.load() > 0;
|
||||
return QWindowSystemInterfacePrivate::eventAccepted.loadRelaxed() > 0;
|
||||
}
|
||||
|
||||
void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
@ -1156,7 +1156,7 @@ bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFla
|
||||
// (excluding flush events). This state can then be
|
||||
// returned by flushWindowSystemEvents().
|
||||
if (event->type != QWindowSystemInterfacePrivate::FlushEvents)
|
||||
QWindowSystemInterfacePrivate::eventAccepted.store(event->eventAccepted);
|
||||
QWindowSystemInterfacePrivate::eventAccepted.storeRelaxed(event->eventAccepted);
|
||||
|
||||
delete event;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
void QOpenGLFramebufferObjectFormat::detach()
|
||||
{
|
||||
if (d->ref.load() != 1) {
|
||||
if (d->ref.loadRelaxed() != 1) {
|
||||
QOpenGLFramebufferObjectFormatPrivate *newd
|
||||
= new QOpenGLFramebufferObjectFormatPrivate(d);
|
||||
if (!d->ref.deref())
|
||||
|
@ -76,11 +76,11 @@ QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,19 +78,19 @@ QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,27 +80,27 @@ QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,35 +82,35 @@ QOpenGLFunctions_1_3::~QOpenGLFunctions_1_3()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,43 +84,43 @@ QOpenGLFunctions_1_4::~QOpenGLFunctions_1_4()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,47 +85,47 @@ QOpenGLFunctions_1_5::~QOpenGLFunctions_1_5()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,51 +87,51 @@ QOpenGLFunctions_2_0::~QOpenGLFunctions_2_0()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,55 +88,55 @@ QOpenGLFunctions_2_1::~QOpenGLFunctions_2_1()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_1_Core) {
|
||||
d_2_1_Core->refs.deref();
|
||||
Q_ASSERT(d_2_1_Core->refs.load());
|
||||
Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,59 +90,59 @@ QOpenGLFunctions_3_0::~QOpenGLFunctions_3_0()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_1_Core) {
|
||||
d_2_1_Core->refs.deref();
|
||||
Q_ASSERT(d_2_1_Core->refs.load());
|
||||
Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_0_Core) {
|
||||
d_3_0_Core->refs.deref();
|
||||
Q_ASSERT(d_3_0_Core->refs.load());
|
||||
Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,43 +84,43 @@ QOpenGLFunctions_3_1::~QOpenGLFunctions_3_1()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_1_Core) {
|
||||
d_2_1_Core->refs.deref();
|
||||
Q_ASSERT(d_2_1_Core->refs.load());
|
||||
Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_0_Core) {
|
||||
d_3_0_Core->refs.deref();
|
||||
Q_ASSERT(d_3_0_Core->refs.load());
|
||||
Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_1_Core) {
|
||||
d_3_1_Core->refs.deref();
|
||||
Q_ASSERT(d_3_1_Core->refs.load());
|
||||
Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,67 +92,67 @@ QOpenGLFunctions_3_2_Compatibility::~QOpenGLFunctions_3_2_Compatibility()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_1_Core) {
|
||||
d_2_1_Core->refs.deref();
|
||||
Q_ASSERT(d_2_1_Core->refs.load());
|
||||
Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_0_Core) {
|
||||
d_3_0_Core->refs.deref();
|
||||
Q_ASSERT(d_3_0_Core->refs.load());
|
||||
Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_1_Core) {
|
||||
d_3_1_Core->refs.deref();
|
||||
Q_ASSERT(d_3_1_Core->refs.load());
|
||||
Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_2_Core) {
|
||||
d_3_2_Core->refs.deref();
|
||||
Q_ASSERT(d_3_2_Core->refs.load());
|
||||
Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,47 +85,47 @@ QOpenGLFunctions_3_2_Core::~QOpenGLFunctions_3_2_Core()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_1_Core) {
|
||||
d_2_1_Core->refs.deref();
|
||||
Q_ASSERT(d_2_1_Core->refs.load());
|
||||
Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_0_Core) {
|
||||
d_3_0_Core->refs.deref();
|
||||
Q_ASSERT(d_3_0_Core->refs.load());
|
||||
Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_1_Core) {
|
||||
d_3_1_Core->refs.deref();
|
||||
Q_ASSERT(d_3_1_Core->refs.load());
|
||||
Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_2_Core) {
|
||||
d_3_2_Core->refs.deref();
|
||||
Q_ASSERT(d_3_2_Core->refs.load());
|
||||
Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,75 +93,75 @@ QOpenGLFunctions_3_3_Compatibility::~QOpenGLFunctions_3_3_Compatibility()
|
||||
{
|
||||
if (d_1_0_Core) {
|
||||
d_1_0_Core->refs.deref();
|
||||
Q_ASSERT(d_1_0_Core->refs.load());
|
||||
Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Core) {
|
||||
d_1_1_Core->refs.deref();
|
||||
Q_ASSERT(d_1_1_Core->refs.load());
|
||||
Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Core) {
|
||||
d_1_2_Core->refs.deref();
|
||||
Q_ASSERT(d_1_2_Core->refs.load());
|
||||
Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Core) {
|
||||
d_1_3_Core->refs.deref();
|
||||
Q_ASSERT(d_1_3_Core->refs.load());
|
||||
Q_ASSERT(d_1_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Core) {
|
||||
d_1_4_Core->refs.deref();
|
||||
Q_ASSERT(d_1_4_Core->refs.load());
|
||||
Q_ASSERT(d_1_4_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_5_Core) {
|
||||
d_1_5_Core->refs.deref();
|
||||
Q_ASSERT(d_1_5_Core->refs.load());
|
||||
Q_ASSERT(d_1_5_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_0_Core) {
|
||||
d_2_0_Core->refs.deref();
|
||||
Q_ASSERT(d_2_0_Core->refs.load());
|
||||
Q_ASSERT(d_2_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_2_1_Core) {
|
||||
d_2_1_Core->refs.deref();
|
||||
Q_ASSERT(d_2_1_Core->refs.load());
|
||||
Q_ASSERT(d_2_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_0_Core) {
|
||||
d_3_0_Core->refs.deref();
|
||||
Q_ASSERT(d_3_0_Core->refs.load());
|
||||
Q_ASSERT(d_3_0_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_1_Core) {
|
||||
d_3_1_Core->refs.deref();
|
||||
Q_ASSERT(d_3_1_Core->refs.load());
|
||||
Q_ASSERT(d_3_1_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_2_Core) {
|
||||
d_3_2_Core->refs.deref();
|
||||
Q_ASSERT(d_3_2_Core->refs.load());
|
||||
Q_ASSERT(d_3_2_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_3_Core) {
|
||||
d_3_3_Core->refs.deref();
|
||||
Q_ASSERT(d_3_3_Core->refs.load());
|
||||
Q_ASSERT(d_3_3_Core->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_0_Deprecated) {
|
||||
d_1_0_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_1_Deprecated) {
|
||||
d_1_1_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_2_Deprecated) {
|
||||
d_1_2_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_3_Deprecated) {
|
||||
d_1_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_1_4_Deprecated) {
|
||||
d_1_4_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.load());
|
||||
Q_ASSERT(d_1_4_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
if (d_3_3_Deprecated) {
|
||||
d_3_3_Deprecated->refs.deref();
|
||||
Q_ASSERT(d_3_3_Deprecated->refs.load());
|
||||
Q_ASSERT(d_3_3_Deprecated->refs.loadRelaxed());
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user