diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2012-01-29 20:32:22 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-01 22:23:55 +0100 |
commit | b69bb01f11f5104d8e807c7a2bdc92d3ffa394b4 (patch) | |
tree | 1f363f3922a4e51287bd0e6eac1b1f14ff2ba3b1 /src/corelib/io/qprocess_unix.cpp | |
parent | c094891db377d750c0e8290b98971b69161a0552 (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/io/qprocess_unix.cpp')
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index d3e45b19d7..9e35978c77 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -169,16 +169,14 @@ private: }; -Q_GLOBAL_STATIC(QMutex, processManagerGlobalMutex) - static QProcessManager *processManagerInstance = 0; static QProcessManager *processManager() { // The constructor of QProcessManager should be called only once // so we cannot use Q_GLOBAL_STATIC directly for QProcessManager - QMutex *mutex = processManagerGlobalMutex(); - QMutexLocker locker(mutex); + static QBasicMutex processManagerGlobalMutex; + QMutexLocker locker(&processManagerGlobalMutex); if (!processManagerInstance) QProcessPrivate::initializeProcessManager(); @@ -550,10 +548,6 @@ inline pid_t qt_fork() #endif } -#ifdef Q_OS_MAC -Q_GLOBAL_STATIC(QMutex, cfbundleMutex); -#endif - void QProcessPrivate::startProcess() { Q_Q(QProcess); @@ -604,7 +598,8 @@ void QProcessPrivate::startProcess() { // CFBundle is not reentrant, since CFBundleCreate might return a reference // to a cached bundle object. Protect the bundle calls with a mutex lock. - QMutexLocker lock(cfbundleMutex()); + static QBasicMutex cfbundleMutex; + QMutexLocker lock(&cfbundleMutex); QCFType<CFBundleRef> bundle = CFBundleCreate(0, url); url = CFBundleCopyExecutableURL(bundle); } |