diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-22 08:53:31 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-22 09:02:48 (GMT) |
commit | 8502f76e820ab79181a1b8ac54c8431b298a2023 (patch) | |
tree | a45045ac7699d9e29790a528164e916c0512196b | |
parent | 8ad5020940f10d4ecc5c5e8b3b9656531cb84ef3 (diff) | |
download | Qt-8502f76e820ab79181a1b8ac54c8431b298a2023.zip Qt-8502f76e820ab79181a1b8ac54c8431b298a2023.tar.gz Qt-8502f76e820ab79181a1b8ac54c8431b298a2023.tar.bz2 |
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.
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 7 |
1 files 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<QByteArray> &typeNames) return types; } -QBasicAtomicPointer<QMutexPool> signalSlotMutexes = Q_BASIC_ATOMIC_INITIALIZER(0); -QBasicAtomicInt objectCount = Q_BASIC_ATOMIC_INITIALIZER(0); +static QBasicAtomicPointer<QMutexPool> 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; } } |