diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-11-14 22:04:37 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-11-14 22:04:37 +0200 |
commit | 7fceb3a63f0157c7075c77e6d8516079ff4d217a (patch) | |
tree | 19f23fe6dc1c2d396de32b32608352091ebda332 /indra/llcommon/llcleanup.h | |
parent | 6c7fabdec76eda60fa27640d115e06e2bbfc12e4 (diff) | |
parent | c52f621e20737b553a9a9e7f1c961f5d5fbc6f89 (diff) |
Merged in lindenlab/viewer-cleanup
Diffstat (limited to 'indra/llcommon/llcleanup.h')
-rw-r--r-- | indra/llcommon/llcleanup.h | 33 |
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) */ |