summaryrefslogtreecommitdiff
path: root/ace/OS.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-01 22:53:33 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-01 22:53:33 +0000
commit0d59a482479b08784dd1e4b43c61b90fd87ba8c1 (patch)
tree5f04c6ebe736d6336d5745e6facdfcc09ddf7c4a /ace/OS.cpp
parent85abfce1fff3340bb7cb52511e96fcd6b4666dec (diff)
downloadATCD-0d59a482479b08784dd1e4b43c61b90fd87ba8c1.tar.gz
fixed ObjMan state logic to ensure that the ACE_Object_Manager is fini'd before the ACE_OS_Object_Manager
Diffstat (limited to 'ace/OS.cpp')
-rw-r--r--ace/OS.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index d97bdfbaa0f..8d0cff9c00a 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -5926,7 +5926,7 @@ ACE_OS_CString::ACE_OS_CString (const char *s)
ACE_Object_Manager_Base::Object_Manager_State
ACE_Object_Manager_Base::object_manager_state_ =
- ACE_Object_Manager_Base::UNINITIALIZED_OBJ_MAN;
+ ACE_Object_Manager_Base::UNINITIALIZED_OBJ_MAN;
# define ACE_OS_PREALLOCATE_OBJECT(TYPE, ID)\
{\
@@ -6023,7 +6023,7 @@ ACE_OS_Object_Manager::instance (void)
int
ACE_OS_Object_Manager::init (void)
{
- if (object_manager_state_ < INITIALIZING_ACE_OS_OBJ_MAN)
+ if (starting_up ())
{
// First, indicate that the ACE_OS_Object_Manager instance is being
// initialized.
@@ -6079,7 +6079,7 @@ ACE_OS_Object_Manager::init (void)
int
ACE_OS_Object_Manager::fini (void)
{
- if (instance_ == 0 || object_manager_state_ >= SHUTTING_DOWN_ACE_OS_OBJ_MAN)
+ if (instance_ == 0 || shutting_down ())
// Too late. Or, maybe too early. Either fini () has already
// been called, or init () was never called.
return -1;
@@ -6087,14 +6087,17 @@ ACE_OS_Object_Manager::fini (void)
// No mutex here. Only the main thread should destroy the singleton
// ACE_OS_Object_Manager instance.
+ // If another Object_Manager has registered for termination, do it.
+ if (next_)
+ {
+ next_->fini ();
+ next_ = 0; // Protect against recursive calls.
+ }
+
// First, indicate that the ACE_OS_Object_Manager instance is being
// shut down.
object_manager_state_ = SHUTTING_DOWN_ACE_OS_OBJ_MAN;
- // If another Object_Manager has registered for termination, do it.
- if (next_)
- next_->fini ();
-
// Close down Winsock (no-op on other platforms).
ACE_OS::socket_fini ();