summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmortician.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2007-01-02 08:33:20 +0000
committerJames Cook <james@lindenlab.com>2007-01-02 08:33:20 +0000
commit420b91db29485df39fd6e724e782c449158811cb (patch)
treeb471a94563af914d3ed3edd3e856d21cb1b69945 /indra/llcommon/llmortician.cpp
Print done when done.
Diffstat (limited to 'indra/llcommon/llmortician.cpp')
-rw-r--r--indra/llcommon/llmortician.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp
new file mode 100644
index 0000000000..eddfbb559e
--- /dev/null
+++ b/indra/llcommon/llmortician.cpp
@@ -0,0 +1,51 @@
+/**
+ * @file llmortician.cpp
+ *
+ * Copyright (c) 2005-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#include "llmortician.h"
+
+#include <list>
+
+std::list<LLMortician*> gGraveyard;
+
+BOOL LLMortician::sDestroyImmediate = FALSE;
+
+LLMortician::~LLMortician()
+{
+ gGraveyard.remove(this);
+}
+
+void LLMortician::updateClass()
+{
+ while (!gGraveyard.empty())
+ {
+ LLMortician* dead = gGraveyard.front();
+ delete dead;
+ }
+}
+
+void LLMortician::die()
+{
+ // It is valid to call die() more than once on something that hasn't died yet
+ if (sDestroyImmediate)
+ {
+ //HACK: we need to do this to ensure destruction order on shutdown
+ mIsDead = TRUE;
+ delete this;
+ return;
+ }
+ else if (!mIsDead)
+ {
+ mIsDead = TRUE;
+ gGraveyard.push_back(this);
+ }
+}
+
+// static
+void LLMortician::setZealous(BOOL b)
+{
+ sDestroyImmediate = b;
+}