summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/nativewifi/main.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-28 18:48:11 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-05-12 18:31:17 +0000
commit29ac941c1e13d067000fe57a441ff55604d46848 (patch)
tree046821388e2eaa0286ba04f0780cc1bcf5a884c1 /src/plugins/bearer/nativewifi/main.cpp
parente9d1d659a34386950c6740f5fb3b9c222b25a65d (diff)
Bearer: replace the use of QMutexPool in the Windows plugin
Use a simple Q_GLOBAL_STATIC Change-Id: Ifea6e497f11a461db432ffff1449b14b63628c12 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/bearer/nativewifi/main.cpp')
-rw-r--r--src/plugins/bearer/nativewifi/main.cpp59
1 files changed, 24 insertions, 35 deletions
diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp
index 48d79d37ee..62245a118b 100644
--- a/src/plugins/bearer/nativewifi/main.cpp
+++ b/src/plugins/bearer/nativewifi/main.cpp
@@ -35,7 +35,6 @@
#include "platformdefs.h"
#include <QtCore/qmutex.h>
-#include <QtCore/private/qmutexpool_p.h>
#include <QtCore/qlibrary.h>
#include <QtNetwork/private/qbearerplugin_p.h>
@@ -46,42 +45,32 @@
QT_BEGIN_NAMESPACE
-static void resolveLibrary()
+static bool resolveLibraryInternal()
{
- static QBasicAtomicInt triedResolve = Q_BASIC_ATOMIC_INITIALIZER(false);
-
- if (!triedResolve.loadAcquire()) {
-#ifndef QT_NO_THREAD
- QMutexLocker locker(QMutexPool::globalInstanceGet(&local_WlanOpenHandle));
-#endif
-
- if (!triedResolve.load()) {
- QLibrary wlanapiLib(QLatin1String("wlanapi"));
- local_WlanOpenHandle = (WlanOpenHandleProto)
- wlanapiLib.resolve("WlanOpenHandle");
- local_WlanRegisterNotification = (WlanRegisterNotificationProto)
- wlanapiLib.resolve("WlanRegisterNotification");
- local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
- wlanapiLib.resolve("WlanEnumInterfaces");
- local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
- wlanapiLib.resolve("WlanGetAvailableNetworkList");
- local_WlanQueryInterface = (WlanQueryInterfaceProto)
- wlanapiLib.resolve("WlanQueryInterface");
- local_WlanConnect = (WlanConnectProto)
- wlanapiLib.resolve("WlanConnect");
- local_WlanDisconnect = (WlanDisconnectProto)
- wlanapiLib.resolve("WlanDisconnect");
- local_WlanScan = (WlanScanProto)
- wlanapiLib.resolve("WlanScan");
- local_WlanFreeMemory = (WlanFreeMemoryProto)
- wlanapiLib.resolve("WlanFreeMemory");
- local_WlanCloseHandle = (WlanCloseHandleProto)
- wlanapiLib.resolve("WlanCloseHandle");
-
- triedResolve.storeRelease(true);
- }
- }
+ QLibrary wlanapiLib(QLatin1String("wlanapi"));
+ local_WlanOpenHandle = (WlanOpenHandleProto)
+ wlanapiLib.resolve("WlanOpenHandle");
+ local_WlanRegisterNotification = (WlanRegisterNotificationProto)
+ wlanapiLib.resolve("WlanRegisterNotification");
+ local_WlanEnumInterfaces = (WlanEnumInterfacesProto)
+ wlanapiLib.resolve("WlanEnumInterfaces");
+ local_WlanGetAvailableNetworkList = (WlanGetAvailableNetworkListProto)
+ wlanapiLib.resolve("WlanGetAvailableNetworkList");
+ local_WlanQueryInterface = (WlanQueryInterfaceProto)
+ wlanapiLib.resolve("WlanQueryInterface");
+ local_WlanConnect = (WlanConnectProto)
+ wlanapiLib.resolve("WlanConnect");
+ local_WlanDisconnect = (WlanDisconnectProto)
+ wlanapiLib.resolve("WlanDisconnect");
+ local_WlanScan = (WlanScanProto)
+ wlanapiLib.resolve("WlanScan");
+ local_WlanFreeMemory = (WlanFreeMemoryProto)
+ wlanapiLib.resolve("WlanFreeMemory");
+ local_WlanCloseHandle = (WlanCloseHandleProto)
+ wlanapiLib.resolve("WlanCloseHandle");
+ return true;
}
+Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
class QNativeWifiEnginePlugin : public QBearerEnginePlugin
{