diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.cpp | 4 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_unix.cpp | 9 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo_win.cpp | 8 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 484cad9395..511bec8f23 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -55,7 +55,6 @@ QT_BEGIN_NAMESPACE static QBasicAtomicPointer<QNetworkConfigurationManagerPrivate> connManager_ptr; -Q_GLOBAL_STATIC(QMutex, connManager_mutex) static void connManager_cleanup() { @@ -74,7 +73,8 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() { QNetworkConfigurationManagerPrivate *ptr = connManager_ptr.loadAcquire(); if (!ptr) { - QMutexLocker locker(connManager_mutex()); + static QBasicMutex connManager_mutex; + QMutexLocker locker(&connManager_mutex); if (!(ptr = connManager_ptr.loadAcquire())) { ptr = new QNetworkConfigurationManagerPrivate; diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index 934d5c4c0e..71eb240812 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -63,10 +63,7 @@ #endif #if defined (QT_NO_GETADDRINFO) -#include <qmutex.h> -QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QMutex, getHostByNameMutex) -QT_END_NAMESPACE +static QBasicMutex getHostByNameMutex; #endif QT_BEGIN_NAMESPACE @@ -267,7 +264,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) // reentrant on all platforms. For now this is okay since we only // use one QHostInfoAgent, but if more agents are introduced, locking // must be provided. - QMutexLocker locker(::getHostByNameMutex()); + QMutexLocker locker(&getHostByNameMutex); hostent *result = gethostbyname(aceHostname.constData()); if (result) { if (result->h_addrtype == AF_INET) { @@ -348,7 +345,7 @@ QString QHostInfo::localDomainName() #if defined(QT_NO_GETADDRINFO) // We have to call res_init to be sure that _res was initialized // So, for systems without getaddrinfo (which is thread-safe), we lock the mutex too - QMutexLocker locker(::getHostByNameMutex()); + QMutexLocker locker(&getHostByNameMutex); #endif local_res_init(); QString domainName = QUrl::fromAce(local_res->defdname); diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index be1d067cef..a00389e3ed 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -95,15 +95,11 @@ static void resolveLibrary() #endif } -#if defined(Q_OS_WINCE) -#include <qmutex.h> -Q_GLOBAL_STATIC(QMutex, qPrivCEMutex) -#endif - QHostInfo QHostInfoAgent::fromName(const QString &hostName) { #if defined(Q_OS_WINCE) - QMutexLocker locker(qPrivCEMutex()); + static QBasicMutex qPrivCEMutex; + QMutexLocker locker(&qPrivCEMutex); #endif QWindowsSockInit winSock; |