IBAMR  IBAMR version 0.19.
Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Static Private Attributes | List of all members
SAMRAI::tbox::ShutdownRegistry Struct Reference

Class ShutdownRegistry is a utility for managing callbacks at program completion.
More...

#include <tbox/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
 

Static Private Member Functions

static void initialize ()
 

Static Private Attributes

static const short s_number_of_priorities = 255
 
static ShutdownRegistryItem * s_shutdown_list [s_number_of_priorities]
 
static ShutdownRegistryItem * s_shutdown_list_last [s_number_of_priorities]
 
static int s_num_shutdown_items [s_number_of_priorities]
 
static bool s_initialized
 

Detailed Description

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.

Member Function Documentation

◆ registerShutdownRoutine()

static 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.

Parameters
callbackThe function to call on shutdown
priorityThe priority (254 called first, 0 last)

◆ callRegisteredShutdowns()

static 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.

◆ initialize()

static void SAMRAI::tbox::ShutdownRegistry::initialize ( )
staticprivate

Member Data Documentation

◆ priorityLogger

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityLogger = 05
static

◆ priorityArenaManager

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityArenaManager = 10
static

◆ priorityReferenceCounter

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityReferenceCounter = 20
static

◆ priorityList

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityList = 30
static

◆ priorityInputManager

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityInputManager = 40
static

◆ priorityRestartManager

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityRestartManager = 50
static

◆ priorityVariableDatabase

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityVariableDatabase = 60
static

◆ priorityStatistician

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityStatistician = 70
static

◆ priorityBoundaryLookupTable

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityBoundaryLookupTable = 80
static

◆ priorityHierarchyDataOpsManager

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityHierarchyDataOpsManager = 90
static

◆ priorityTimers

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityTimers = 95
static

◆ priorityTimerManger

const unsigned char SAMRAI::tbox::ShutdownRegistry::priorityTimerManger = 98
static

◆ s_number_of_priorities

const short SAMRAI::tbox::ShutdownRegistry::s_number_of_priorities = 255
staticprivate

◆ s_shutdown_list

ShutdownRegistryItem* SAMRAI::tbox::ShutdownRegistry::s_shutdown_list[s_number_of_priorities]
staticprivate

◆ s_shutdown_list_last

ShutdownRegistryItem* SAMRAI::tbox::ShutdownRegistry::s_shutdown_list_last[s_number_of_priorities]
staticprivate

◆ s_num_shutdown_items

int SAMRAI::tbox::ShutdownRegistry::s_num_shutdown_items[s_number_of_priorities]
staticprivate

◆ s_initialized

bool SAMRAI::tbox::ShutdownRegistry::s_initialized
staticprivate

The documentation for this struct was generated from the following file: