summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qregexp.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-01-29 20:32:22 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-01 22:23:55 +0100
commitb69bb01f11f5104d8e807c7a2bdc92d3ffa394b4 (patch)
tree1f363f3922a4e51287bd0e6eac1b1f14ff2ba3b1 /src/corelib/tools/qregexp.cpp
parentc094891db377d750c0e8290b98971b69161a0552 (diff)
Use QBasicMutex instead of Q_GLOBAL_STATIC QMutex
QBasicMutex is a POD and can be used as a static global object. in qpicture.cpp factoryLoader is used only once, and under the mutex, so there is no need for Q_GLOBAL_STATIC for it, it can be a function static in qhostinfo_unix.cpp the code seemed wrong while compiled with namespace and QT_NO_GETADDRINFO. I also could get rid of one include because it was included earlier. Change-Id: I3c700203c3e067266c20733f4bda8031446dbb86 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qregexp.cpp')
-rw-r--r--src/corelib/tools/qregexp.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 70cae5ceee..421d15c436 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -3809,7 +3809,7 @@ uint qHash(const QRegExpEngineKey &key)
typedef QCache<QRegExpEngineKey, QRegExpEngine> EngineCache;
Q_GLOBAL_STATIC(EngineCache, globalEngineCache)
-Q_GLOBAL_STATIC(QMutex, mutex)
+static QBasicMutex globalEngineCacheMutex;
#endif // QT_NO_REGEXP_OPTIM
static void derefEngine(QRegExpEngine *eng, const QRegExpEngineKey &key)
@@ -3817,7 +3817,7 @@ static void derefEngine(QRegExpEngine *eng, const QRegExpEngineKey &key)
if (!eng->ref.deref()) {
#if !defined(QT_NO_REGEXP_OPTIM)
if (globalEngineCache()) {
- QMutexLocker locker(mutex());
+ QMutexLocker locker(&globalEngineCacheMutex);
QT_TRY {
globalEngineCache()->insert(key, eng, 4 + key.pattern.length() / 4);
} QT_CATCH(const std::bad_alloc &) {
@@ -3839,7 +3839,7 @@ static void prepareEngine_helper(QRegExpPrivate *priv)
bool initMatchState = !priv->eng;
#if !defined(QT_NO_REGEXP_OPTIM)
if (!priv->eng && globalEngineCache()) {
- QMutexLocker locker(mutex());
+ QMutexLocker locker(&globalEngineCacheMutex);
priv->eng = globalEngineCache()->take(priv->engineKey);
if (priv->eng != 0)
priv->eng->ref.ref();