Ensure that the ACE_Object_Manager gets initialized at program startup, and destroyed at program termination. More...
Public Member Functions | |
ACE_Object_Manager_Manager (void) | |
~ACE_Object_Manager_Manager (void) | |
Private Attributes | |
ACE_thread_t | saved_main_thread_id_ |
Save the main thread ID, so that destruction can be suppressed. |
Ensure that the ACE_Object_Manager gets initialized at program startup, and destroyed at program termination.
Without ACE_HAS_NONSTATIC_OBJECT_MANAGER, a static instance of this class is created. Therefore, it gets created before main () is called. And it gets destroyed after main () returns.
Definition at line 856 of file Object_Manager.cpp.
ACE_Object_Manager_Manager::ACE_Object_Manager_Manager | ( | void | ) |
Definition at line 867 of file Object_Manager.cpp.
: saved_main_thread_id_ (ACE_OS::thr_self ()) { // Ensure that the Object_Manager gets initialized before any // application threads have been spawned. Because this will be called // during construction of static objects, that should always be the // case. (void) ACE_Object_Manager::instance (); }
ACE_Object_Manager_Manager::~ACE_Object_Manager_Manager | ( | void | ) |
Definition at line 877 of file Object_Manager.cpp.
{ if (ACE_OS::thr_equal (ACE_OS::thr_self (), saved_main_thread_id_)) { delete ACE_Object_Manager::instance_; ACE_Object_Manager::instance_ = 0; } // else if this destructor is not called by the main thread, then do // not delete the ACE_Object_Manager. That causes problems, on // WIN32 at least. }
Save the main thread ID, so that destruction can be suppressed.
Definition at line 864 of file Object_Manager.cpp.