mirror of https://github.com/PCSX2/pcsx2.git
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
This commit is contained in:
parent
c439d1bef2
commit
d231c537b9
|
@ -26,10 +26,17 @@
|
||||||
namespace Threading
|
namespace Threading
|
||||||
{
|
{
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// BaseTlsVariable
|
// TlsVariable - Thread local storage
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// This container is for complex non-copyable objects that require explicit cleanup and
|
// Wrapper class for pthread_getspecific, which is pthreads language for "thread local
|
||||||
// stuff (most classes). For simple types and such, use TlsVariable.
|
// 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 >
|
template< typename T >
|
||||||
class BaseTlsVariable
|
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 >
|
template< typename T >
|
||||||
class TlsVariable : public BaseTlsVariable<T>
|
class TlsVariable : public BaseTlsVariable<T>
|
||||||
{
|
{
|
||||||
|
@ -114,6 +109,9 @@ public:
|
||||||
m_IsDisposed = true;
|
m_IsDisposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is needed the C++ standard likes making life suck for programmers.
|
||||||
|
using BaseTlsVariable<T>::GetRef;
|
||||||
|
|
||||||
TlsVariable& operator=( const T& src )
|
TlsVariable& operator=( const T& src )
|
||||||
{
|
{
|
||||||
GetRef() = src;
|
GetRef() = src;
|
||||||
|
|
Loading…
Reference in New Issue