Changeset 561 for trunk/src/corelib/thread/qmutexpool.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/corelib/thread/qmutexpool.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 50 50 // use QMutexpool::instance() in new clode. 51 51 Q_CORE_EXPORT QMutexPool *qt_global_mutexpool = 0; 52 Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, ( true))52 Q_GLOBAL_STATIC_WITH_ARGS(QMutexPool, globalMutexPool, (e)) 53 53 54 54 /*! … … 89 89 90 90 /*! 91 Constructs a QMutexPool, reserving space for \a size QMutexes. If92 \a recursive is true, all QMutexes in the pool will be recursive93 mutexes; otherwise they will all be non-recursive (the default).91 Constructs a QMutexPool, reserving space for \a size QMutexes. 92 93 . 94 94 95 95 The QMutexes are created when needed, and deleted when the 96 96 QMutexPool is destructed. 97 97 */ 98 QMutexPool::QMutexPool( bool recursive, int size)99 : mutexes(size), count(size), recurs(recursive)98 QMutexPool::QMutexPool(e, int size) 99 : mutexes(size), e) 100 100 { 101 for (int index = 0; index < count; ++index) {101 for (int index = 0; index < ; ++index) { 102 102 mutexes[index] = 0; 103 103 } … … 110 110 QMutexPool::~QMutexPool() 111 111 { 112 for (int index = 0; index < count; ++index) {112 for (int index = 0; index < ; ++index) { 113 113 delete mutexes[index]; 114 114 mutexes[index] = 0; … … 131 131 { 132 132 Q_ASSERT_X(address != 0, "QMutexPool::get()", "'address' argument cannot be zero"); 133 int index = int((quintptr(address) >> (sizeof(address) >> 1)) % count);133 int index = int((quintptr(address) >> (sizeof(address) >> 1)) % ); 134 134 135 135 if (!mutexes[index]) { 136 136 // mutex not created, create one 137 QMutex *newMutex = new QMutex(recurs ? QMutex::Recursive : QMutex::NonRecursive);137 QMutex *newMutex = new QMutex(recurse); 138 138 if (!mutexes[index].testAndSetOrdered(0, newMutex)) 139 139 delete newMutex;
Note:
See TracChangeset
for help on using the changeset viewer.