aboutsummaryrefslogtreecommitdiffstats
path: root/alc/context.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-09-11 19:34:55 -0700
committerChris Robinson <[email protected]>2023-09-11 19:34:55 -0700
commit6722ad196145ef7334d7478bdd375308801e7096 (patch)
tree60ca9a830e7601e8eb4289696b565d852cbb9760 /alc/context.h
parent43fac7e95568a2b7205db365a49e3938b05e913b (diff)
Make some global and static member variables inline
This also seems to work around the problematic MinGW code generation, so the indirection to access it can be removed.
Diffstat (limited to 'alc/context.h')
-rw-r--r--alc/context.h11
1 files changed, 1 insertions, 10 deletions
diff --git a/alc/context.h b/alc/context.h
index f936bbe8..201c8873 100644
--- a/alc/context.h
+++ b/alc/context.h
@@ -211,7 +211,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext>, ContextBase {
private:
/* Thread-local current context. */
- static thread_local ALCcontext *sLocalContext;
+ static inline thread_local ALCcontext *sLocalContext{};
/* Thread-local context handling. This handles attempting to release the
* context which may have been left current when the thread is destroyed.
@@ -224,17 +224,8 @@ private:
static thread_local ThreadCtx sThreadContext;
public:
- /* 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__
- static ALCcontext *getThreadContext() noexcept;
- static void setThreadContext(ALCcontext *context) noexcept;
-#else
static ALCcontext *getThreadContext() noexcept { return sLocalContext; }
static void setThreadContext(ALCcontext *context) noexcept { sThreadContext.set(context); }
-#endif
/* Default effect that applies to sources that don't have an effect on send 0. */
static ALeffect sDefaultEffect;