diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-04-01 17:45:04 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-04-01 17:45:04 +0000 |
commit | 941cb9f4124c9ccfd5c845bc94639fa46df12c3d (patch) | |
tree | e0f525e7bd6cc76d89b2df69c6f1554d191561e8 /indra/llcommon/llmemory.h | |
parent | ecec626dec93524f7ef5831a5ba344d6449b99bc (diff) |
merge release@83343 skinning-1-merge@83714 -> release
QAR-424
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r-- | indra/llcommon/llmemory.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index b0a47b6820..cc57e658fb 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -419,6 +419,31 @@ protected: // Foo* instance = FooSingleton::getInstance(); // // As currently written, it is not thread-safe. +#if LL_WINDOWS && _MSC_VER < 1400 // this is Visual C++ 2003 or earlier +// workaround for VC7 compiler bug +// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx +// our version doesn't introduce a nested struct so that you can still declare LLSingleton<MyClass> +// a friend and hide your constructor + +template <typename T> +class LLSingleton +{ +public: + static T* getInstance() + { + LLSingleton<T> singleton; + return singleton.get(); + } +private: + T* get() + { + static T instance; + return &instance; + } + +}; +#else + template <typename T> class LLSingleton { @@ -430,6 +455,8 @@ public: } }; +#endif + //---------------------------------------------------------------------------- // Return the resident set size of the current process, in bytes. |