diff options
author | Sven Gothel <sgothel@jausoft.com> | 2023-11-28 12:51:46 +0100 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2023-11-28 12:51:46 +0100 |
commit | 1aaf4f070011490bcece50394b9b32dfa593fd9e (patch) | |
tree | 17d68284e401a35eea3d3a574d986d446a60763a /router/router.h | |
parent | 6e7cee4fa9a8af03f28ca26cd89f8357390dfc90 (diff) | |
parent | 571b546f35eead77ce109f8d4dd6c3de3199d573 (diff) |
Merge remote-tracking branch 'upstream/master'
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 { |