summaryrefslogtreecommitdiff
path: root/indra/llcommon/llcleanup.h
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2016-12-08 14:27:40 -0500
committerNat Goodspeed <nat@lindenlab.com>2016-12-08 14:27:40 -0500
commitb6dc755786fb06ab109eb36f402a25edaf24ce14 (patch)
tree04f465dd42a555f15bf2729ad4a2fcea181db1c9 /indra/llcommon/llcleanup.h
parent5bb456d80cfbcdfe87526510f3b8297d315afdd8 (diff)
parenta65b586b184d9837e0586b4df0d2e758ccce63f6 (diff)
Automated merge with ssh://bitbucket.org/lindenlab/viewer-skip-llcorehttp-test
Diffstat (limited to 'indra/llcommon/llcleanup.h')
-rw-r--r--indra/llcommon/llcleanup.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/indra/llcommon/llcleanup.h b/indra/llcommon/llcleanup.h
new file mode 100644
index 0000000000..a319171b5f
--- /dev/null
+++ b/indra/llcommon/llcleanup.h
@@ -0,0 +1,33 @@
+/**
+ * @file llcleanup.h
+ * @author Nat Goodspeed
+ * @date 2015-05-20
+ * @brief Mechanism for cleaning up subsystem resources
+ *
+ * $LicenseInfo:firstyear=2015&license=viewerlgpl$
+ * Copyright (c) 2015, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_LLCLEANUP_H)
+#define LL_LLCLEANUP_H
+
+#include <boost/current_function.hpp>
+
+// Instead of directly calling SomeClass::cleanupClass(), use
+// SUBSYSTEM_CLEANUP(SomeClass);
+// This logs the call as well as performing it. That gives us a baseline
+// subsystem shutdown order against which to compare subsequent dynamic
+// shutdown schemes.
+#define SUBSYSTEM_CLEANUP(CLASSNAME) \
+ do { \
+ log_subsystem_cleanup(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, #CLASSNAME); \
+ CLASSNAME::cleanupClass(); \
+ } while (0)
+// Use ancient do { ... } while (0) macro trick to permit a block of
+// statements with the same syntax as a single statement.
+
+void log_subsystem_cleanup(const char* file, int line, const char* function,
+ const char* classname);
+
+#endif /* ! defined(LL_LLCLEANUP_H) */