From 420b91db29485df39fd6e724e782c449158811cb Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 2 Jan 2007 08:33:20 +0000 Subject: Print done when done. --- indra/llcommon/llmortician.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 indra/llcommon/llmortician.cpp (limited to 'indra/llcommon/llmortician.cpp') 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 + +std::list 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; +} -- cgit v1.2.3