summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-23 20:49:15 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-06-23 20:49:15 +0000
commit9f569464fa6cea98ecb864eb3bc2341ee97fbc09 (patch)
tree6a3599c8e3dde97e2aa2f507fa57204e33d5c363
parenteb7071a9033a3cb2c88d16e35c2bfdf8d291114d (diff)
downloadATCD-9f569464fa6cea98ecb864eb3bc2341ee97fbc09.tar.gz
Changed to implement collocation lock using ACE_Adaptive_Lock.
-rw-r--r--TAO/tao/ORB_Core.cpp63
-rw-r--r--TAO/tao/ORB_Core.h36
2 files changed, 8 insertions, 91 deletions
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 42dad0f76ba..bd157bc3a1c 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -15,12 +15,9 @@
typedef ACE_TSS_Singleton<TAO_ORB_Core, ACE_SYNCH_MUTEX>
TAO_ORB_CORE;
-ACE_Lock *TAO_COLTBL_Lock::coltbl_lock_ = 0;
-
TAO_COLTBL_Lock::TAO_COLTBL_Lock (void)
{
- if (TAO_COLTBL_Lock::coltbl_lock_ == 0)
- TAO_COLTBL_Lock::coltbl_lock_ =TAO_ORB_Core_instance ()->server_factory ()->create_coltbl_lock ();
+ this->lock_ =TAO_ORB_Core_instance ()->server_factory ()->create_coltbl_lock ();
// We don't need to worry about the race condition here because this
// is called from within the ctor of Hash_Map_Manager which is
// placed inside a ACE_Singleton.
@@ -28,62 +25,8 @@ TAO_COLTBL_Lock::TAO_COLTBL_Lock (void)
TAO_COLTBL_Lock::~TAO_COLTBL_Lock (void)
{
- delete TAO_COLTBL_Lock::coltbl_lock_;
- TAO_COLTBL_Lock::coltbl_lock_ = 0;
-}
-
-int
-TAO_COLTBL_Lock::remove (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->remove ();
-}
-
-int
-TAO_COLTBL_Lock::acquire (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->acquire ();
-}
-
-int
-TAO_COLTBL_Lock::tryacquire (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->tryacquire ();
-}
-
-int
-TAO_COLTBL_Lock::release (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->release ();
-}
-
-int
-TAO_COLTBL_Lock::acquire_read (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->acquire_read ();
-}
-
-int
-TAO_COLTBL_Lock::acquire_write (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->acquire_write ();
-}
-
-int
-TAO_COLTBL_Lock::tryacquire_read (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->tryacquire_read ();
-}
-
-int
-TAO_COLTBL_Lock::tryacquire_write (void)
-{
- return TAO_COLTBL_Lock::coltbl_lock_->tryacquire_write ();
-}
-
-void
-TAO_COLTBL_Lock::dump (void) const
-{
- // return TAO_COLTBL_Lock::coltbl_lock_->dump ();
+ delete this->lock_;
+ this->lock_ = 0;
}
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index 350dfe442da..2097f09b501 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -34,40 +34,14 @@ typedef ACE_NOOP_Concurrency_Strategy<TAO_Client_Connection_Handler>
TAO_NULL_ACTIVATION_STRATEGY;
-class TAO_COLTBL_Lock : public ACE_Lock
+class TAO_COLTBL_Lock : public ACE_Adaptive_Lock
{
- // = TITLE
- // A specialized lock class to facilitate using different lock in
- // the global collocation table at run time.
- //
- // = DESCRIPTION
- // Because the lock used in ACE_Hash_Map_Manager is template
- // parameterized, we can only choose the lock to use in it at
- // compile time which does not give us enough flexibility. This
- // class uses the Bridge pattern to relay the operations to the
- // lock of our choice.
-
+ // TITLE
+ // This lock class determines the type underlying lock
+ // when it gets constructed.
public:
TAO_COLTBL_Lock (void);
- // Ctor gets the lock from server resource factory.
-
- virtual ~TAO_COLTBL_Lock (void);
- // Dtor deallocate the lock.
-
- // = Lock/unlock operations.
-
- virtual int remove (void);
- virtual int acquire (void);
- virtual int tryacquire (void);
- virtual int release (void);
- virtual int acquire_read (void);
- virtual int acquire_write (void);
- virtual int tryacquire_read (void);
- virtual int tryacquire_write (void);
- void dump () const;
-
-private:
- static ACE_Lock *coltbl_lock_;
+ ~TAO_COLTBL_Lock (void);
};
typedef ACE_Hash_Map_Manager<ACE_Hash_Addr<ACE_INET_Addr>, TAO_POA *, TAO_COLTBL_Lock>