diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index f3b4195f81..cddd94c8f3 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -30,6 +30,9 @@ #endif #endif +/* Assume TLS doesn't work until told otherwise. It's ArchHooks's job to set this. */ +bool RageThread::m_bSystemSupportsTLS = false; + #define MAX_THREADS 128 //static vector *g_MutexList = NULL; /* watch out for static initialization order problems */ diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index 526744c280..91fc9feb56 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -7,6 +7,8 @@ class RageThread ThreadSlot *m_pSlot; CString name; + static bool m_bSystemSupportsTLS; + public: RageThread(); ~RageThread(); @@ -28,6 +30,13 @@ public: static bool EnumThreadIDs( int n, uint64_t &iID ); int Wait(); bool IsCreated() const { return m_pSlot != NULL; } + + /* A system can define HAVE_TLS, indicating that it can compile thread_local + * code, but an individual environment may not actually have functional TLS. + * If this returns false, thread_local variables are considered undefined. */ + static bool GetSupportsTLS() { return m_bSystemSupportsTLS; } + + static void SetSupportsTLS( bool b ) { m_bSystemSupportsTLS = b; } }; namespace Checkpoints