aboutsummaryrefslogtreecommitdiffstats
path: root/router
diff options
context:
space:
mode:
Diffstat (limited to 'router')
-rw-r--r--router/al.cpp2
-rw-r--r--router/router.cpp9
-rw-r--r--router/router.h18
3 files changed, 5 insertions, 24 deletions
diff --git a/router/al.cpp b/router/al.cpp
index c7e01d51..6ed8a626 100644
--- a/router/al.cpp
+++ b/router/al.cpp
@@ -7,8 +7,6 @@
#include "router.h"
-std::atomic<DriverIface*> CurrentCtxDriver{nullptr};
-
#define DECL_THUNK1(R,n,T1) AL_API R AL_APIENTRY n(T1 a) noexcept \
{ \
DriverIface *iface = GetThreadDriver(); \
diff --git a/router/router.cpp b/router/router.cpp
index b2274c0b..e2ba91d1 100644
--- a/router/router.cpp
+++ b/router/router.cpp
@@ -17,18 +17,9 @@
#include "version.h"
-std::vector<DriverIfacePtr> DriverList;
-
-thread_local DriverIface *ThreadCtxDriver;
-
enum LogLevel LogLevel = LogLevel_Error;
FILE *LogFile;
-#ifdef __MINGW32__
-DriverIface *GetThreadDriver() noexcept { return ThreadCtxDriver; }
-void SetThreadDriver(DriverIface *driver) noexcept { ThreadCtxDriver = driver; }
-#endif
-
static void LoadDriverList(void);
diff --git a/router/router.h b/router/router.h
index 2a126d42..f5c7f455 100644
--- a/router/router.h
+++ b/router/router.h
@@ -173,21 +173,13 @@ struct DriverIface {
};
using DriverIfacePtr = std::unique_ptr<DriverIface>;
-extern std::vector<DriverIfacePtr> DriverList;
-
-extern thread_local DriverIface *ThreadCtxDriver;
-extern std::atomic<DriverIface*> CurrentCtxDriver;
-
-/* HACK: MinGW generates bad code when accessing an extern thread_local object.
- * Add a wrapper function for it that only accesses it where it's defined.
- */
-#ifdef __MINGW32__
-DriverIface *GetThreadDriver() noexcept;
-void SetThreadDriver(DriverIface *driver) noexcept;
-#else
+inline std::vector<DriverIfacePtr> DriverList;
+
+inline thread_local DriverIface *ThreadCtxDriver{};
+inline std::atomic<DriverIface*> CurrentCtxDriver{};
+
inline DriverIface *GetThreadDriver() noexcept { return ThreadCtxDriver; }
inline void SetThreadDriver(DriverIface *driver) noexcept { ThreadCtxDriver = driver; }
-#endif
class PtrIntMap {