summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostinfo_win.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-06 09:07:18 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-06 15:36:44 +0200
commitdbef41f43ece97d8ac4d6b63f7a36afcb7e7b7f7 (patch)
tree334ebaec198a7f31d1e3a4639c70fbb8bb116af2 /src/network/kernel/qhostinfo_win.cpp
parent52d30e2850769d589772576e4714a14241c7da6e (diff)
parentf57d8f1341587e6b2aa84b8404aa218432584206 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: examples/qtestlib/tutorial5/containers.cpp examples/widgets/tools/tools.pro src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/network/kernel/qdnslookup_unix.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp tools/configure/configureapp.cpp Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
Diffstat (limited to 'src/network/kernel/qhostinfo_win.cpp')
-rw-r--r--src/network/kernel/qhostinfo_win.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index cc6102a713..b98f36a612 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -45,7 +45,6 @@
#include <qmutex.h>
#include <qbasicatomic.h>
#include <qurl.h>
-#include <private/qmutexpool_p.h>
QT_BEGIN_NAMESPACE
@@ -78,7 +77,7 @@ static getnameinfoProto local_getnameinfo = 0;
static getaddrinfoProto local_getaddrinfo = 0;
static freeaddrinfoProto local_freeaddrinfo = 0;
-static void resolveLibrary()
+static bool resolveLibraryInternal()
{
// Attempt to resolve getaddrinfo(); without it we'll have to fall
// back to gethostbyname(), which has no IPv6 support.
@@ -95,7 +94,9 @@ static void resolveLibrary()
local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "freeaddrinfo");
local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getnameinfo");
#endif
+ return true;
}
+Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
static void translateWSAError(int error, QHostInfo *results)
{
@@ -123,14 +124,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QSysInfo::machineHostName(); // this initializes ws2_32.dll
// Load res_init on demand.
- static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
- if (!triedResolve.loadAcquire()) {
- QMutexLocker locker(QMutexPool::globalInstanceGet(&local_getaddrinfo));
- if (!triedResolve.load()) {
- resolveLibrary();
- triedResolve.storeRelease(true);
- }
- }
+ resolveLibrary();
QHostInfo results;