summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-12-05 21:25:48 +0000
committermarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-12-05 21:25:48 +0000
commit23ba9aa559fa498f486a50ea33581a4ce1028180 (patch)
treee5153d8ea730f2e29aede69d46bdfe0f69a8bb82
parentd10acbe2bd82e6ba452b4ea459fefcbc3b5935eb (diff)
downloadATCD-23ba9aa559fa498f486a50ea33581a4ce1028180.tar.gz
ChangeLogTag:Tue Dec 5 15:07:45 2000 Marina Spivak <marina@cs.wustl.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a11
-rw-r--r--TAO/tao/Policy_Manager.h4
-rw-r--r--TAO/tao/Policy_Manager.i90
3 files changed, 84 insertions, 21 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 4a3332ca5cd..ca763f5653c 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,6 +1,15 @@
+Tue Dec 5 15:07:45 2000 Marina Spivak <marina@cs.wustl.edu>
+
+ * tao/Policy_Manager.h
+ * tao/Policy_Manager.cpp:
+
+ All policy accessors in TAO_Policy_Manager now use
+ double-checked locking. This should significantly improve
+ performance on the critical path.
+
Tue Dec 5 12:57:33 2000 Ossama Othman <ossama@uci.edu>
- * tests/Portable_Interceptors/Benchmark/server.cpp (main):
+ * tests/Portable_Interceptors/Benchmark/server.cpp (main):
* tests/Portable_Interceptors/Dynamic/server.cpp (main):
* tests/Portable_Interceptors/Service_Context_Manipulation/server.cpp
(main):
diff --git a/TAO/tao/Policy_Manager.h b/TAO/tao/Policy_Manager.h
index dc04151dc59..6aa07dc3cb1 100644
--- a/TAO/tao/Policy_Manager.h
+++ b/TAO/tao/Policy_Manager.h
@@ -61,7 +61,11 @@ class TAO_Export TAO_Policy_Manager_Impl
// This class is used to implement both the CORBA::PolicyManager
// and the CORBA::PolicyCurrent interfaces.
//
+
+ friend class TAO_Policy_Manager;
+
public:
+
TAO_Policy_Manager_Impl (void);
// Constructor
diff --git a/TAO/tao/Policy_Manager.i b/TAO/tao/Policy_Manager.i
index 5aae563badf..ace3f0f3f11 100644
--- a/TAO/tao/Policy_Manager.i
+++ b/TAO/tao/Policy_Manager.i
@@ -77,8 +77,13 @@ TAO_Policy_Manager::set_policy_overrides (
ACE_INLINE CORBA::Policy *
TAO_Policy_Manager::relative_roundtrip_timeout (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.relative_roundtrip_timeout ();
+ // Double-checked locking.
+ if (this->impl_.relative_roundtrip_timeout_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.relative_roundtrip_timeout ();
+ }
+ return 0;
}
#if (TAO_HAS_CLIENT_PRIORITY_POLICY == 1)
@@ -86,8 +91,13 @@ TAO_Policy_Manager::relative_roundtrip_timeout (void)
ACE_INLINE TAO_Client_Priority_Policy *
TAO_Policy_Manager::client_priority (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.client_priority ();
+ // Double-checked locking.
+ if (this->impl_.client_priority_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.client_priority ();
+ }
+ return 0;
}
#endif /* TAO_HAS_CLIENT_PRIORITY_POLICY == 1 */
@@ -95,8 +105,13 @@ TAO_Policy_Manager::client_priority (void)
ACE_INLINE CORBA::Policy *
TAO_Policy_Manager::sync_scope (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.sync_scope ();
+ // Double-checked locking.
+ if (this->impl_.sync_scope_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.sync_scope ();
+ }
+ return 0;
}
#if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
@@ -104,8 +119,13 @@ TAO_Policy_Manager::sync_scope (void)
ACE_INLINE TAO_Buffering_Constraint_Policy *
TAO_Policy_Manager::buffering_constraint (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.buffering_constraint ();
+ // Double-checked locking.
+ if (this->impl_.buffering_constraint_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.buffering_constraint ();
+ }
+ return 0;
}
#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
@@ -115,43 +135,73 @@ TAO_Policy_Manager::buffering_constraint (void)
ACE_INLINE TAO_PriorityModelPolicy *
TAO_Policy_Manager::priority_model (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.priority_model ();
+ // Double-checked locking.
+ if (this->impl_.priority_model_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.priority_model ();
+ }
+ return 0;
}
ACE_INLINE TAO_ThreadpoolPolicy *
TAO_Policy_Manager::threadpool (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.threadpool ();
+ // Double-checked locking.
+ if (this->impl_.threadpool_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.threadpool ();
+ }
+ return 0;
}
ACE_INLINE TAO_PrivateConnectionPolicy *
TAO_Policy_Manager::private_connection (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.private_connection ();
+ // Double-checked locking.
+ if (this->impl_.private_connection_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.private_connection ();
+ }
+ return 0;
}
ACE_INLINE TAO_PriorityBandedConnectionPolicy *
TAO_Policy_Manager::priority_banded_connection (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.priority_banded_connection ();
+ // Double-checked locking.
+ if (this->impl_.priority_banded_connection_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.priority_banded_connection ();
+ }
+ return 0;
}
ACE_INLINE TAO_ServerProtocolPolicy *
TAO_Policy_Manager::server_protocol (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.server_protocol ();
+ // Double-checked locking.
+ if (this->impl_.server_protocol_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.server_protocol ();
+ }
+ return 0;
}
ACE_INLINE TAO_ClientProtocolPolicy *
TAO_Policy_Manager::client_protocol (void)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
- return this->impl_.client_protocol ();
+ // Double-checked locking.
+ if (this->impl_.client_protocol_)
+ {
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
+ return this->impl_.client_protocol ();
+ }
+ return 0;
}
#endif /* TAO_HAS_RT_CORBA == 1 */