diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-19 16:34:02 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-03-19 16:34:02 +0000 |
commit | 657513f687d217cc8cc0ff8d811af316a16f7216 (patch) | |
tree | 481bc4a3b4e7a9bdb35ad37a3bcd9773a014dcbb /ace | |
parent | 783fd94c2fcc929e746d1a264926e602ab474878 (diff) | |
download | ATCD-657513f687d217cc8cc0ff8d811af316a16f7216.tar.gz |
(ACE_OS_Object_Manager ctor): allow newer instances to overwrite older ones, in case an application #defines ACE_HAS_NONSTATIC_OBJECT_MANAGER and uses the Object_Manager during construction of static objects. Added ACE_FINI_HOOK support.
Diffstat (limited to 'ace')
-rw-r--r-- | ace/OS.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp index ea8c09264ca..7e0f7f59d4f 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -6032,17 +6032,17 @@ void *ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_OS_Object_Manager () { - if (instance_ == 0) - { - // Store the address of the instance so that instance () doesn't - // allocate a new one when called. - instance_ = this; + // If Instance_ was not 0, then another ACE_OS_Object_Manager has + // already been instantiated. Because this might be the non-static + // instance (with ACE_HAS_NONSTATIC_OBJECT_MANAGER), use it and leak + // the old one. We can't destroy it, because the application might + // be using some of its resources, via static constructors. - init (); - } - // else if ACE_Object_Manager_instance_ was not 0, then then another - // ACE_Object_Manager has already been instantiated. Don't do - // anything, so that it will own all ACE_Object_Manager resources. + // Store the address of the instance so that instance () doesn't + // allocate a new one when called. + instance_ = this; + + init (); } ACE_OS_Object_Manager::~ACE_OS_Object_Manager () @@ -6198,6 +6198,12 @@ ACE_OS_Object_Manager::fini (void) } #endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ +#if defined (ACE_FINI_HOOK) + // ACE_FINI_HOOK can be defined in ace/config.h to do whatever + // you want. + ACE_FINI_HOOK; +#endif /* ACE_FINI_HOOK */ + return 0; } |