Ensure that the ACE_OS_Object_Manager gets initialized at program startup, and destroyed at program termination. More...
Public Member Functions | |
ACE_OS_Object_Manager_Manager (void) | |
Constructor. | |
~ACE_OS_Object_Manager_Manager (void) | |
Destructor. | |
Private Attributes | |
ACE_thread_t | saved_main_thread_id_ |
Save the main thread ID, so that destruction can be suppressed. |
Ensure that the ACE_OS_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 467 of file Object_Manager_Base.cpp.
ACE_OS_Object_Manager_Manager::ACE_OS_Object_Manager_Manager | ( | void | ) |
Constructor.
Definition at line 481 of file Object_Manager_Base.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_OS_Object_Manager::instance (); }
ACE_OS_Object_Manager_Manager::~ACE_OS_Object_Manager_Manager | ( | void | ) |
Destructor.
Definition at line 491 of file Object_Manager_Base.cpp.
{ if (ACE_OS::thr_equal (ACE_OS::thr_self (), saved_main_thread_id_)) { delete ACE_OS_Object_Manager::instance_; ACE_OS_Object_Manager::instance_ = 0; } // else if this destructor is not called by the main thread, then do // not delete the ACE_OS_Object_Manager. That causes problems, on // WIN32 at least. }
Save the main thread ID, so that destruction can be suppressed.
Definition at line 478 of file Object_Manager_Base.cpp.