#include <source/toolbox/base/ShutdownRegistry.h>
Static Public Member Functions | |
static void | registerShutdownRoutine (void(*callback)(), unsigned char priority) |
static void | callRegisteredShutdowns () |
Static Public Attributes | |
static const unsigned char | priorityLogger = 05 |
static const unsigned char | priorityArenaManager = 10 |
static const unsigned char | priorityReferenceCounter = 20 |
static const unsigned char | priorityList = 30 |
static const unsigned char | priorityInputManager = 40 |
static const unsigned char | priorityRestartManager = 50 |
static const unsigned char | priorityVariableDatabase = 60 |
static const unsigned char | priorityStatistician = 70 |
static const unsigned char | priorityBoundaryLookupTable = 80 |
static const unsigned char | priorityHierarchyDataOpsManager = 90 |
static const unsigned char | priorityTimers = 95 |
static const unsigned char | priorityTimerManger = 98 |
Classes that wish to have a static function called at program shutdown must register a class via registerShutdownRoutine(). The registered shutdown handler is then called at shutdown when the callRegisteredShutdowns() is invoked. Note that the application program must explicitly call callRegisteredShutdowns().
This class is useful in releasing allocated class-specific static memory on program completion to simplify the search for memory leaks.
void SAMRAI::tbox::ShutdownRegistry::registerShutdownRoutine | ( | void(*)() | callback, | |
unsigned char | priority | |||
) | [static] |
Register a shutdown routine with the ShutdownRegistry. The shutdown handler must take no arguments and returns no value.
The priority is used to specify the order for shutdowns, higher numbers are shutdown first, lower last (254 first, 0 last).
The priority is required since handlers can depend on one another. Basic handlers like Lists should be last, higher level handlers (which may free Lists) should be shutdown first.
Users are reserved priorities 254 to 127. Unless there is a known dependency on a SAMRAI shutdown handler, users should use these priorities.
There is a potential for an infinite loop if routines register themselves with the registry as part of the shutdown.
callback | The function to call on shutdown | |
priority | The priority (254 called first, 0 last) |
void SAMRAI::tbox::ShutdownRegistry::callRegisteredShutdowns | ( | ) | [static] |
Invoke the registered shutdown handlers. Note that this routine must be explicitly called at the end of the application. This routine may only be called once, since the registered information is discarded at the end of this call.
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityLogger = 05 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityArenaManager = 10 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityReferenceCounter = 20 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityList = 30 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityInputManager = 40 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityRestartManager = 50 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityVariableDatabase = 60 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityStatistician = 70 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityBoundaryLookupTable = 80 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityHierarchyDataOpsManager = 90 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityTimers = 95 [static] |
const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityTimerManger = 98 [static] |