Vault
4.1
|
The shutdown registry allows you to register a handler object that will be called to clean up when the program shuts down. More...
#include <vshutdownregistry.h>
Public Member Functions | |
void | registerHandler (IVShutdownHandler *handler) |
Registers a shutdown handler with the shutdown registry. | |
void | registerFunction (shutdownFunction func) |
Registers a shutdown function with the shutdown registry. | |
Static Public Member Functions | |
static VShutdownRegistry * | instance () |
Returns the global shutdown registry instance, creating it if this is the first call to access it. | |
static void | shutdown () |
Invokes shutdown by deleting the registry. |
The shutdown registry allows you to register a handler object that will be called to clean up when the program shuts down.
This is intended to be used as a clean way of allow you to free any "global" resources you've allocated, that otherwise would have to be automatically deleted by the operating system as part of program termination. That is, it's for things like freeing memory that you want to not look like a memory leak by any diagnostics that check for unfreed memory on quit.
Definition at line 67 of file vshutdownregistry.h.
VShutdownRegistry * VShutdownRegistry::instance | ( | ) | [static] |
Returns the global shutdown registry instance, creating it if this is the first call to access it.
Definition at line 23 of file vshutdownregistry.cpp.
References NULL.
void VShutdownRegistry::shutdown | ( | ) | [static] |
Invokes shutdown by deleting the registry.
This is the better than simply deleting the registry instance because it's done in a threadsafe fashion that guarantees singleton behavior even if inadvertently called from multiple places and multiple threads.
Definition at line 34 of file vshutdownregistry.cpp.
References NULL.
void VShutdownRegistry::registerHandler | ( | IVShutdownHandler * | handler | ) |
Registers a shutdown handler with the shutdown registry.
The handler's _shutdown() will be called to shut down when the registry is told to shut down.
Definition at line 43 of file vshutdownregistry.cpp.
void VShutdownRegistry::registerFunction | ( | shutdownFunction | func | ) |
Registers a shutdown function with the shutdown registry.
The function will be called to shut down when the registry is told to shut down.
Definition at line 49 of file vshutdownregistry.cpp.