summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostinfo_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/kernel/qhostinfo_win.cpp')
-rw-r--r--src/network/kernel/qhostinfo_win.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp
index 8ace68d961..5c91d75e5c 100644
--- a/src/network/kernel/qhostinfo_win.cpp
+++ b/src/network/kernel/qhostinfo_win.cpp
@@ -46,6 +46,7 @@
#include <ws2tcpip.h>
#include <private/qsystemlibrary_p.h>
#include <qmutex.h>
+#include <qbasicatomic.h>
#include <qurl.h>
#include <private/qmutexpool_p.h>
@@ -121,12 +122,12 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QWindowsSockInit winSock;
// Load res_init on demand.
- static volatile bool triedResolve = false;
- if (!triedResolve) {
+ static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
+ if (!triedResolve.loadAcquire()) {
QMutexLocker locker(QMutexPool::globalInstanceGet(&local_getaddrinfo));
- if (!triedResolve) {
+ if (!triedResolve.load()) {
resolveLibrary();
- triedResolve = true;
+ triedResolve.storeRelease(true);
}
}