From d231c537b96a893dfc45cdc3a978ded67a262891 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" <Jake.Stine@96395faa-99c1-11dd-bbfe-3dabce05a288> Date: Wed, 4 Aug 2010 19:36:15 +0000 Subject: [PATCH] Linux fix for TlsVariable.inl (I hope). SafeArray fix will have to come later. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3601 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/Utilities/TlsVariable.inl | 30 +++++++++++------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/common/include/Utilities/TlsVariable.inl b/common/include/Utilities/TlsVariable.inl index dc17016c0e..9dba8740ca 100644 --- a/common/include/Utilities/TlsVariable.inl +++ b/common/include/Utilities/TlsVariable.inl @@ -26,10 +26,17 @@ namespace Threading { // -------------------------------------------------------------------------------------- -// BaseTlsVariable +// TlsVariable - Thread local storage // -------------------------------------------------------------------------------------- -// This container is for complex non-copyable objects that require explicit cleanup and -// stuff (most classes). For simple types and such, use TlsVariable. +// Wrapper class for pthread_getspecific, which is pthreads language for "thread local +// storage." This class enables code to act as a drop-in replacement for compiler-native +// thread local storage (typically specified via __threadlocal). Mac OS/X (Darwin) does +// not have TLS, which is the main reason for this class existing. +// +// Performance considerations: While certainly convenient, performance of this class can +// be sub-optimal when the operator overloads are used, since each one will most likely +// result in repeated calls to pthread_getspecific. (if the function inlines then it +// should actually optimize well enough, but I doubt it does). // template< typename T > class BaseTlsVariable @@ -80,19 +87,7 @@ protected: } }; -// -------------------------------------------------------------------------------------- -// TlsVariable - Thread local storage -// -------------------------------------------------------------------------------------- -// Wrapper class for pthread_getspecific, which is pthreads language for "thread local -// storage." This class enables code to act as a drop-in replacement for compiler-native -// thread local storage (typically specified via __threadlocal). Mac OS/X (Darwin) does -// not have TLS, which is the main reason for this class existing. -// -// Performance considerations: While certainly convenient, performance of this class can -// be sub-optimal when the operator overloads are used, since each one will most likely -// result in repeated calls to pthread_getspecific. (if the function inlines then it -// should actually optimize well enough, but I doubt it does). -// + template< typename T > class TlsVariable : public BaseTlsVariable<T> { @@ -114,6 +109,9 @@ public: m_IsDisposed = true; } + // This is needed the C++ standard likes making life suck for programmers. + using BaseTlsVariable<T>::GetRef; + TlsVariable& operator=( const T& src ) { GetRef() = src;