diff options
Diffstat (limited to 'router/router.h')
-rw-r--r-- | router/router.h | 18 |
1 files changed, 5 insertions, 13 deletions
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 { |