diff options
Diffstat (limited to 'TAO/tao/MProfile.i')
-rw-r--r-- | TAO/tao/MProfile.i | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i index 4eee314cef0..a3a89690d54 100644 --- a/TAO/tao/MProfile.i +++ b/TAO/tao/MProfile.i @@ -4,7 +4,6 @@ ACE_INLINE TAO_MProfile::TAO_MProfile (CORBA::ULong sz) : policy_list_ (0), - is_policy_list_initialized_ (0), forward_from_(0), pfiles_ (0), current_ (0), @@ -45,7 +44,7 @@ TAO_MProfile::~TAO_MProfile (void) (*policy_list_)[i]->destroy (); } delete policy_list_; - + this->cleanup (); } @@ -258,11 +257,11 @@ TAO_MProfile::create_policy_list (void) ACE_ASSERT (this->policy_list_ == 0); ACE_NEW (this->policy_list_, CORBA::PolicyList ()); - + // Post-Condition: Make sure that the memory get allcated // for real. ACE_ASSERT (this->policy_list_ != 0); - + // @@ Marina & Irfan I would raise an exception in this case. } @@ -273,34 +272,15 @@ TAO_MProfile::policy_list (CORBA::PolicyList *policy_list) this->policy_list_ = policy_list; } -ACE_INLINE CORBA::PolicyList* -TAO_MProfile::policy_list (void) +ACE_INLINE CORBA::PolicyList* +TAO_MProfile::policy_list (void) { - - // Here we use Double-Checked Loking to - // avoid to create more then one policy list - // if more thread try to get a policy for - // the first time, at the same time. - - if (this->is_policy_list_initialized_) - return this->policy_list_; - else + if (this->policy_list_ == 0) { - ACE_Guard<ACE_Recursive_Thread_Mutex> guard (this->mutex_); - if (this->policy_list_ == 0) - { - this->create_policy_list (); - // Init Policy. - this->get_current_profile ()->policies (); - // Right now all the profile share the same - // policies, so any profile can be picked up - // to parse the policy. - // So we pick the current profile, so that no - // state is changed in the MProfile. - - this->is_policy_list_initialized_ = 1; - } + this->create_policy_list (); + // Init Policy. + this->rewind (); + this->get_next ()->policies (); } return this->policy_list_; - -} +} |