diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2021-11-24 10:47:54 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2021-11-24 10:47:54 -0500 |
commit | 0b066539fe68dc5750900c3452189645c40adb45 (patch) | |
tree | fd01b6eaf174f7744fd82a28b0b948d301fd4d2b /indra/llcommon/llsingleton.h | |
parent | 78d837789a3741c65c3334934d96a505a522ee43 (diff) |
DRTVWR-546, SL-16220, SL-16094: Undo previous glthread branch revert.
Reverting a merge is sticky: it tells git you never want to see that branch
again. Merging the DRTVWR-546 branch, which contained the revert, into the
glthread branch undid much of the development work on that branch. To restore
it we must revert the revert.
This reverts commit 029b41c0419e975bbb28454538b46dc69ce5d2ba.
Diffstat (limited to 'indra/llcommon/llsingleton.h')
-rw-r--r-- | indra/llcommon/llsingleton.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index f85f961287..6042c0906c 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -847,14 +847,13 @@ template<class T> class LLSimpleton { public: - static T* sInstance; - - static void createInstance() - { + template <typename... ARGS> + static void createInstance(ARGS&&... args) + { llassert(sInstance == nullptr); - sInstance = new T(); + sInstance = new T(std::forward<ARGS>(args)...); } - + static inline T* getInstance() { return sInstance; } static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } @@ -864,6 +863,9 @@ public: delete sInstance; sInstance = nullptr; } + +private: + static T* sInstance; }; template <class T> |