diff options
author | aavit <qt-info@nokia.com> | 2011-04-26 08:28:04 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2011-04-26 08:28:04 (GMT) |
commit | ff8c99eb54f33108709f9f3107b35780a80f3f17 (patch) | |
tree | 11d4c08809bf90fd8b25b175b4903ab00d36e3d6 /src/corelib/thread/qmutexpool.cpp | |
parent | 28c7e17d9eeb8264ad9e26a5b93e5ff744add9a6 (diff) | |
parent | 7ef9f99301a7c71fdb835f9e1f27d3111557aa2e (diff) | |
download | Qt-ff8c99eb54f33108709f9f3107b35780a80f3f17.zip Qt-ff8c99eb54f33108709f9f3107b35780a80f3f17.tar.gz Qt-ff8c99eb54f33108709f9f3107b35780a80f3f17.tar.bz2 |
Merge remote branch 'qt-mainline/master'
Conflicts:
configure
Diffstat (limited to 'src/corelib/thread/qmutexpool.cpp')
-rw-r--r-- | src/corelib/thread/qmutexpool.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/corelib/thread/qmutexpool.cpp b/src/corelib/thread/qmutexpool.cpp index 13e29c3..144fa35 100644 --- a/src/corelib/thread/qmutexpool.cpp +++ b/src/corelib/thread/qmutexpool.cpp @@ -123,22 +123,20 @@ QMutexPool *QMutexPool::instance() return globalMutexPool(); } -/*! +/*! \fn QMutexPool::get(void *address) Returns a QMutex from the pool. QMutexPool uses the value \a address to determine which mutex is returned from the pool. */ -QMutex *QMutexPool::get(const void *address) -{ - Q_ASSERT_X(address != 0, "QMutexPool::get()", "'address' argument cannot be zero"); - int index = int((quintptr(address) >> (sizeof(address) >> 1)) % mutexes.count()); - - if (!mutexes[index]) { - // mutex not created, create one - QMutex *newMutex = new QMutex(recursionMode); - if (!mutexes[index].testAndSetOrdered(0, newMutex)) - delete newMutex; - } +/*! \internal + create the mutex for the given index + */ +QMutex *QMutexPool::createMutex(int index) +{ + // mutex not created, create one + QMutex *newMutex = new QMutex(recursionMode); + if (!mutexes[index].testAndSetOrdered(0, newMutex)) + delete newMutex; return mutexes[index]; } |