aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/llmemory.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llcommon/llmemory.h
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llcommon/llmemory.h')
-rw-r--r--linden/indra/llcommon/llmemory.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/linden/indra/llcommon/llmemory.h b/linden/indra/llcommon/llmemory.h
index e1af7ba..c10661a 100644
--- a/linden/indra/llcommon/llmemory.h
+++ b/linden/indra/llcommon/llmemory.h
@@ -419,6 +419,31 @@ protected:
419// Foo* instance = FooSingleton::getInstance(); 419// Foo* instance = FooSingleton::getInstance();
420// 420//
421// As currently written, it is not thread-safe. 421// As currently written, it is not thread-safe.
422#if LL_WINDOWS && _MSC_VER < 1400 // this is Visual C++ 2003 or earlier
423// workaround for VC7 compiler bug
424// adapted from http://www.codeproject.com/KB/tips/VC2003MeyersSingletonBug.aspx
425// our version doesn't introduce a nested struct so that you can still declare LLSingleton<MyClass>
426// a friend and hide your constructor
427
428template <typename T>
429class LLSingleton
430{
431public:
432 static T* getInstance()
433 {
434 LLSingleton<T> singleton;
435 return singleton.get();
436 }
437private:
438 T* get()
439 {
440 static T instance;
441 return &instance;
442 }
443
444};
445#else
446
422template <typename T> 447template <typename T>
423class LLSingleton 448class LLSingleton
424{ 449{
@@ -430,6 +455,8 @@ public:
430 } 455 }
431}; 456};
432 457
458#endif
459
433//---------------------------------------------------------------------------- 460//----------------------------------------------------------------------------
434 461
435// Return the resident set size of the current process, in bytes. 462// Return the resident set size of the current process, in bytes.