summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2005-09-29 07:23:49 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2005-09-29 07:23:49 +0000
commit9657259a42f1e4351c965fb4bf93bba39b509676 (patch)
treec501b112104ad20797c3b995127dfc73df3c4f63 /TAO
parent308d9f8651119590d98fff1cff0c4708fd071e0e (diff)
downloadATCD-9657259a42f1e4351c965fb4bf93bba39b509676.tar.gz
ChangeLogTag: Thu Sep 29 07:08:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/tao/Connect_Strategy.h2
-rw-r--r--TAO/tao/ORB.h2
-rw-r--r--TAO/tao/PI_Server/Policy_Creator_T.h20
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp2
-rw-r--r--TAO/tao/Stub.cpp33
-rw-r--r--TAO/tao/Stub.h49
-rw-r--r--TAO/tao/Stub.i20
-rw-r--r--TAO/tao/Thread_Lane_Resources.cpp2
-rw-r--r--TAO/tao/Valuetype/AbstractBase.cpp8
9 files changed, 46 insertions, 92 deletions
diff --git a/TAO/tao/Connect_Strategy.h b/TAO/tao/Connect_Strategy.h
index 488fe149d93..be88ba7ff60 100644
--- a/TAO/tao/Connect_Strategy.h
+++ b/TAO/tao/Connect_Strategy.h
@@ -66,7 +66,7 @@ public:
* connection handler is set appropriately.
*/
virtual int wait (TAO_Connection_Handler *ch,
- ACE_Time_Value *val) = 0;
+ ACE_Time_Value *val) = 0;
virtual int wait (TAO_Transport *t,
ACE_Time_Value *val) = 0;
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
index 98216da8ecd..5fd16d537a9 100644
--- a/TAO/tao/ORB.h
+++ b/TAO/tao/ORB.h
@@ -633,7 +633,7 @@ namespace CORBA
private:
- /// lock required for mutual exclusion between multiple threads.
+ /// Lock required for mutual exclusion between multiple threads.
TAO_SYNCH_MUTEX lock_;
/// Maintains a reference count of number of instantiations of the
diff --git a/TAO/tao/PI_Server/Policy_Creator_T.h b/TAO/tao/PI_Server/Policy_Creator_T.h
index 3846ef81c88..42a5f422d4f 100644
--- a/TAO/tao/PI_Server/Policy_Creator_T.h
+++ b/TAO/tao/PI_Server/Policy_Creator_T.h
@@ -31,16 +31,16 @@ namespace TAO
POLICYVALUE &value,
const CORBA::Any& val
ACE_ENV_ARG_DECL)
- {
- if ((val >>= value) == 0)
- ACE_THROW (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE));
-
- ACE_NEW_THROW_EX (policy,
- POLICYTYPE (value),
- CORBA::NO_MEMORY (TAO::VMCID,
- CORBA::COMPLETED_NO));
- ACE_CHECK;
- }
+ {
+ if ((val >>= value) == 0)
+ ACE_THROW (CORBA::PolicyError (CORBA::BAD_POLICY_VALUE));
+
+ ACE_NEW_THROW_EX (policy,
+ POLICYTYPE (value),
+ CORBA::NO_MEMORY (TAO::VMCID,
+ CORBA::COMPLETED_NO));
+ ACE_CHECK;
+ }
}
}
diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
index cbb5c49a9bb..faba2c2c0c3 100644
--- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
@@ -144,7 +144,7 @@ TAO_SHMIOP_Connection_Handler::open (void*)
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) SHMIOP connection from client")
+ ACE_TEXT ("TAO (%P|%t) - SHMIOP connection from client")
ACE_TEXT ("<%s> on %d\n"),
local_as_string, this->peer ().get_handle ()));
}
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp
index d3bc60dce26..142514560d5 100644
--- a/TAO/tao/Stub.cpp
+++ b/TAO/tao/Stub.cpp
@@ -40,8 +40,7 @@ TAO_Stub::TAO_Stub (const char *repository_id,
, forward_profiles_ (0)
, profile_in_use_ (0)
, profile_lock_ptr_ (0)
- , profile_success_ (0)
- , refcount_lock_ ()
+ , profile_success_ (false)
, refcount_ (1)
#if (TAO_HAS_CORBA_MESSAGING == 1)
, policies_ (0)
@@ -130,9 +129,9 @@ TAO_Stub::add_forward_profiles (const TAO_MProfile &mprofiles)
// make sure we start at the beginning of mprofiles
this->forward_profiles_->rewind ();
- // Since we have been forwarded, we must set profile_success_ to 0
+ // Since we have been forwarded, we must set profile_success_ to false
// since we are starting a new with a new set of profiles!
- this->profile_success_ = 0;
+ this->profile_success_ = false;
// Reset any flags that may be appropriate in the services that
// selects profiles for invocation
@@ -308,33 +307,19 @@ TAO_Stub::is_equivalent (CORBA::Object_ptr other_obj)
// Memory managment
-CORBA::ULong
+void
TAO_Stub::_incr_refcnt (void)
{
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->refcount_lock_,
- 0);
-
- return this->refcount_++;
+ ++this->refcount_;
}
-CORBA::ULong
+void
TAO_Stub::_decr_refcnt (void)
{
- {
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- mon,
- this->refcount_lock_,
- 0);
-
- this->refcount_--;
- if (this->refcount_ != 0)
- return this->refcount_;
- }
+ const CORBA::ULong new_count = --this->refcount_;
- delete this;
- return 0;
+ if (new_count == 0)
+ delete this;
}
TAO_Profile *
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
index 844b5f17d9d..d005c5c6457 100644
--- a/TAO/tao/Stub.h
+++ b/TAO/tao/Stub.h
@@ -25,6 +25,8 @@
#include "tao/MProfile.h"
#include "tao/ORB_Core_Auto_Ptr.h"
+#include "ace/Atomic_Op.h"
+
#if defined (HPUX) && defined (IOR)
/* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
and we don't want that definition. See IOP_IORC.h. */
@@ -115,8 +117,8 @@ public:
TAO_ORB_Core *orb_core);
// = Memory management.
- CORBA::ULong _incr_refcnt (void);
- CORBA::ULong _decr_refcnt (void);
+ void _incr_refcnt (void);
+ void _decr_refcnt (void);
/// Return the Profile lock. This lock can be used at places where
/// profiles need to be edited.
@@ -157,9 +159,6 @@ public:
*/
TAO_Profile *next_profile (void);
- /// NON-THREAD SAFE version of next_profile (void)
- TAO_Profile *next_profile_i (void);
-
/**
* THREAD SAFE
* this method will reset the base profile list to reference the first
@@ -168,9 +167,6 @@ public:
*/
void reset_profiles (void);
- /// NON-THREAD SAFE version of reset_profiles (void);
- void reset_profiles_i (void);
-
/// Returns 1 if a forward profile has successfully been used.
/// profile_success_ && forward_profiles_
CORBA::Boolean valid_forward_profile (void);
@@ -180,7 +176,7 @@ public:
/// Returns TRUE if a connection was successful with at least
/// one profile.
- CORBA::Boolean valid_profile (void);
+ CORBA::Boolean valid_profile (void) const;
/// Initialize the base_profiles_ and set profile_in_use_ to
/// reference the first profile.
@@ -210,7 +206,7 @@ public:
CORBA::ORB_var &servant_orb_var (void);
/**
- * Accesor and mutator for the servant ORB. Notice that the muatator
+ * Accesor and mutator for the servant ORB. Notice that the mutator
* assumes the ownership of the passed in ORB and the accesor does not
* return a copy of the orb since the accessing of the ORB is considered
* temporary.
@@ -225,22 +221,6 @@ public:
CORBA::ULong &index
ACE_ENV_ARG_DECL);
- /// Return a reference to the reference count lock.
- /**
- * This method is meant to be used by the CORBA::Object
- * implementation to allow it to directly manipulate the reference
- * count.
- */
- TAO_SYNCH_MUTEX & refcount_lock (void);
-
- /// Return number of outstanding references to this object.
- /**
- * This method is meant to be used by the CORBA::Object
- * implementation to allow it to directly manipulate the reference
- * count.
- */
- CORBA::ULong & refcount (void);
-
/// Deallocate the TAO_Stub object.
/**
* This method is intended to be used only by the CORBA::Object
@@ -260,6 +240,12 @@ protected:
/// enforce proper reference counting.
virtual ~TAO_Stub (void);
+ /// NON-THREAD SAFE version of reset_profiles (void);
+ void reset_profiles_i (void);
+
+ /// NON-THREAD SAFE version of next_profile (void)
+ TAO_Profile *next_profile_i (void);
+
private:
/// Makes a copy of the profile and frees the existing profile_in_use.
/// NOT THREAD SAFE
@@ -338,13 +324,10 @@ protected:
ACE_Lock* profile_lock_ptr_;
/// Have we successfully talked to the forward profile yet?
- size_t profile_success_;
-
- /// Mutex to protect reference count.
- TAO_SYNCH_MUTEX refcount_lock_;
+ CORBA::Boolean profile_success_;
- /// Number of outstanding references to this object.
- CORBA::ULong refcount_;
+ /// Reference counter.
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> refcount_;
/// The policy overrides in this object, if nil then use the default
/// policies.
@@ -384,7 +367,7 @@ class TAO_Export TAO_Stub_Auto_Ptr
{
public:
// = Initialization and termination methods.
- /* explicit */ TAO_Stub_Auto_Ptr (TAO_Stub *p = 0);
+ explicit TAO_Stub_Auto_Ptr (TAO_Stub *p = 0);
TAO_Stub_Auto_Ptr (TAO_Stub_Auto_Ptr &ap);
TAO_Stub_Auto_Ptr &operator= (TAO_Stub_Auto_Ptr &rhs);
~TAO_Stub_Auto_Ptr (void);
diff --git a/TAO/tao/Stub.i b/TAO/tao/Stub.i
index b18c71d5428..4f11130af6b 100644
--- a/TAO/tao/Stub.i
+++ b/TAO/tao/Stub.i
@@ -6,7 +6,7 @@ ACE_INLINE void
TAO_Stub::reset_base (void)
{
this->base_profiles_.rewind ();
- this->profile_success_ = 0;
+ this->profile_success_ = false;
this->set_profile_in_use_i (base_profiles_.get_next ());
}
@@ -115,13 +115,13 @@ TAO_Stub::valid_forward_profile (void)
ACE_INLINE void
TAO_Stub::set_valid_profile (void)
{
- this->profile_success_ = 1;
+ this->profile_success_ = true;
}
ACE_INLINE CORBA::Boolean
-TAO_Stub::valid_profile (void)
+TAO_Stub::valid_profile (void) const
{
- return (CORBA::Boolean) this->profile_success_;
+ return this->profile_success_;
}
ACE_INLINE TAO_Profile *
@@ -223,18 +223,6 @@ TAO_Stub::servant_orb (CORBA::ORB_ptr orb)
this->servant_orb_ = CORBA::ORB::_duplicate (orb);
}
-ACE_INLINE TAO_SYNCH_MUTEX &
-TAO_Stub::refcount_lock (void)
-{
- return this->refcount_lock_;
-}
-
-ACE_INLINE CORBA::ULong &
-TAO_Stub::refcount (void)
-{
- return this->refcount_;
-}
-
ACE_INLINE void
TAO_Stub::destroy (void)
{
diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp
index 6d7db43e10c..1168a525d4f 100644
--- a/TAO/tao/Thread_Lane_Resources.cpp
+++ b/TAO/tao/Thread_Lane_Resources.cpp
@@ -500,10 +500,8 @@ TAO_Thread_Lane_Resources::shutdown_reactor (void)
ace_mon,
leader_follower.lock ());
-
ACE_Reactor *reactor = leader_follower.reactor ();
-
// Wakeup all the threads waiting blocked in the event loop, this
// does not guarantee that they will all go away, but reduces the
// load on the POA....
diff --git a/TAO/tao/Valuetype/AbstractBase.cpp b/TAO/tao/Valuetype/AbstractBase.cpp
index 87f6cb0b85d..e8f0d633759 100644
--- a/TAO/tao/Valuetype/AbstractBase.cpp
+++ b/TAO/tao/Valuetype/AbstractBase.cpp
@@ -57,7 +57,7 @@ CORBA::AbstractBase::AbstractBase (const CORBA::AbstractBase &rhs)
{
if (rhs.concrete_stubobj_ != 0)
{
- (void) rhs.concrete_stubobj_->_incr_refcnt ();
+ rhs.concrete_stubobj_->_incr_refcnt ();
}
if (!CORBA::is_nil (rhs.equivalent_obj_))
@@ -81,7 +81,7 @@ CORBA::AbstractBase::AbstractBase (TAO_Stub * protocol_proxy,
{
TAO_Stub *stub = this->concrete_stubobj_;
- (void) stub->_incr_refcnt ();
+ stub->_incr_refcnt ();
this->equivalent_obj_ =
stub->orb_core ()->create_object (stub);
@@ -93,7 +93,7 @@ CORBA::AbstractBase::~AbstractBase (void)
{
if (this->concrete_stubobj_ != 0)
{
- (void) this->concrete_stubobj_->_decr_refcnt ();
+ this->concrete_stubobj_->_decr_refcnt ();
}
}
@@ -415,7 +415,7 @@ CORBA::AbstractBase::equivalent_objref (void)
TAO_ORB_Core *orb_core =
this->concrete_stubobj_->orb_core ();
- (void) this->concrete_stubobj_->_incr_refcnt ();
+ this->concrete_stubobj_->_incr_refcnt ();
this->equivalent_obj_ =
orb_core->create_object (this->concrete_stubobj_);