From 8502f76e820ab79181a1b8ac54c8431b298a2023 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 22 May 2009 10:53:31 +0200 Subject: Mark data as static, use fetch-and-store instead of test-and-set Mark the objectCount and mutex-pool as static as they won't ever be externed. Use fetch-and-store zero instead of test-and-set from current value to zero. --- src/corelib/kernel/qobject.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cfd8493..1e9e284 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -92,8 +92,8 @@ static int *queuedConnectionTypes(const QList &typeNames) return types; } -QBasicAtomicPointer signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); -QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); +static QBasicAtomicPointer signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); +static QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); /** \internal * mutex to be locked when accessing the connectionlists or the senders list @@ -117,8 +117,7 @@ extern "C" Q_CORE_EXPORT void qt_addObject(QObject *) extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) { if(!objectCount.deref()) { - QMutexPool *old = signalSlotMutexes; - signalSlotMutexes.testAndSetAcquire(old, 0); + QMutexPool *old = signalSlotMutexes.fetchAndStoreAcquire(0); delete old; } } -- cgit v0.12