diff options
Diffstat (limited to 'ace/Object_Manager.cpp')
-rw-r--r-- | ace/Object_Manager.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index c6f5e15b430..9ce357842aa 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -235,15 +235,16 @@ ACE_Object_Manager::init (void) ACE_TSS_Emulation::tss_open (ts_storage_); # endif /* ACE_HAS_TSS_EMULATION */ - ACE_NEW_RETURN (preallocations_, ACE_Object_Manager_Preallocations, + ACE_NEW_RETURN (preallocations_, + ACE_Object_Manager_Preallocations, -1); - // Open the main thread's ACE_Log_Msg. (void) ACE_LOG_MSG; } - ACE_NEW_RETURN (default_mask_, ACE_Sig_Set (1), -1); - + ACE_NEW_RETURN (default_mask_, + ACE_Sig_Set (1), + -1); // Finally, indicate that the ACE_Object_Manager instance has // been initialized. object_manager_state_ = OBJ_MAN_INITIALIZED; @@ -301,7 +302,9 @@ ACE_Object_Manager::instance (void) { ACE_Object_Manager *instance_pointer; - ACE_NEW_RETURN (instance_pointer, ACE_Object_Manager, 0); + ACE_NEW_RETURN (instance_pointer, + ACE_Object_Manager, + 0); ACE_ASSERT (instance_pointer == instance_); instance_pointer->dynamically_allocated_ = 1; @@ -309,9 +312,7 @@ ACE_Object_Manager::instance (void) return instance_pointer; } else - { - return instance_; - } + return instance_; } ACE_Sig_Set & @@ -401,41 +402,40 @@ ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock) { if (lock == 0) { - if (starting_up () || shutting_down ()) - { - // The Object_Manager and its internal lock have not been - // constructed yet. Therefore, the program is single- - // threaded at this point. Or, the ACE_Object_Manager - // instance has been destroyed, so the internal lock is not - // available. Either way, we can not use double-checked - // locking. So, we'll leak the lock. - - ACE_NEW_RETURN (lock, ACE_Thread_Mutex, -1); - } - else + if (starting_up () || shutting_down ()) + // The Object_Manager and its internal lock have not been + // constructed yet. Therefore, the program is single- + // threaded at this point. Or, the ACE_Object_Manager + // instance has been destroyed, so the internal lock is not + // available. Either way, we can not use double-checked + // locking. So, we'll leak the lock. + ACE_NEW_RETURN (lock, + ACE_Thread_Mutex, + -1); + } + else + { + // Allocate a new lock, but use double-checked locking to + // ensure that only one thread allocates it. + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, + *ACE_Object_Manager::instance ()-> + internal_lock_, + -1)); + + if (lock == 0) { - // Allocate a new lock, but use double-checked locking to - // ensure that only one thread allocates it. - ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, - ace_mon, - *ACE_Object_Manager::instance ()-> - internal_lock_, - -1)); - - if (lock == 0) - { - ACE_Cleanup_Adapter<ACE_Thread_Mutex> *lock_adapter; - ACE_NEW_RETURN (lock_adapter, - ACE_Cleanup_Adapter<ACE_Thread_Mutex>, - -1); - lock = &lock_adapter->object (); + ACE_Cleanup_Adapter<ACE_Thread_Mutex> *lock_adapter; + ACE_NEW_RETURN (lock_adapter, + ACE_Cleanup_Adapter<ACE_Thread_Mutex>, + -1); + lock = &lock_adapter->object (); - // Register the lock for destruction at program - // termination. This call will cause us to grab the - // ACE_Object_Manager::instance ()->internal_lock_ - // again; that's why it is a recursive lock. - ACE_Object_Manager::at_exit (lock_adapter); - } + // Register the lock for destruction at program + // termination. This call will cause us to grab the + // ACE_Object_Manager::instance ()->internal_lock_ + // again; that's why it is a recursive lock. + ACE_Object_Manager::at_exit (lock_adapter); } } @@ -448,16 +448,16 @@ ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock) if (lock == 0) { if (starting_up () || shutting_down ()) - { - // The Object_Manager and its internal lock have not been - // constructed yet. Therefore, the program is single- - // threaded at this point. Or, the ACE_Object_Manager - // instance has been destroyed, so the internal lock is not - // available. Either way, we can not use double-checked - // locking. So, we'll leak the lock. - - ACE_NEW_RETURN (lock, ACE_Mutex, -1); - } + // The Object_Manager and its internal lock have not been + // constructed yet. Therefore, the program is single- + // threaded at this point. Or, the ACE_Object_Manager + // instance has been destroyed, so the internal lock is not + // available. Either way, we can not use double-checked + // locking. So, we'll leak the lock. + + ACE_NEW_RETURN (lock, + ACE_Mutex, + -1); else { // Allocate a new lock, but use double-checked locking to @@ -529,17 +529,17 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock) { if (lock == 0) { - if (starting_up () || shutting_down ()) - { - // The Object_Manager and its internal lock have not been - // constructed yet. Therefore, the program is single- - // threaded at this point. Or, the ACE_Object_Manager - // instance has been destroyed, so the internal lock is not - // available. Either way, we can not use double-checked - // locking. So, we'll leak the lock. - - ACE_NEW_RETURN (lock, ACE_RW_Thread_Mutex, -1); - } + if (starting_up () || shutting_down ()) + // The Object_Manager and its internal lock have not been + // constructed yet. Therefore, the program is single- + // threaded at this point. Or, the ACE_Object_Manager + // instance has been destroyed, so the internal lock is not + // available. Either way, we can not use double-checked + // locking. So, we'll leak the lock. + + ACE_NEW_RETURN (lock, + ACE_RW_Thread_Mutex, + -1); else { // Allocate a new lock, but use double-checked locking to @@ -547,7 +547,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock) ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Object_Manager::instance ()-> - internal_lock_, + internal_lock_, -1)); if (lock == 0) |