summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Concurrency
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Concurrency')
-rw-r--r--TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.cpp83
-rw-r--r--TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.h80
-rw-r--r--TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.cpp81
-rw-r--r--TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.h72
-rw-r--r--TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.cpp71
-rw-r--r--TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.h57
6 files changed, 0 insertions, 444 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.cpp b/TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.cpp
deleted file mode 100644
index 95b81728b88..00000000000
--- a/TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/Concurrency_Service
-//
-// = FILENAME
-// CC_Lock.cpp
-//
-// = DESCRIPTION
-// This class implements a lock used by the lock set from the
-// concurrency control service
-//
-// = AUTHORS
-// Torben Worm <tworm@cs.wustl.edu>
-//
-// ============================================================================
-
-// #include "tao/corba.h"
-#include "CC_Lock.h"
-
-CC_Lock::CC_Lock(CosConcurrencyControl::lock_mode mode) : mode_ (mode)
-{
- semaphore_.open("test"); // @@ The semaphore must have a unique name??
-}
-
-CC_Lock::~CC_Lock()
-{
- semaphore_.close();
-}
-
-void CC_Lock::lock(void)
-{
- semaphore_.acquire();
-}
-
-CORBA::Boolean CC_Lock::try_lock()
-{
- semaphore_.tryacquire(); //@@ What does tryacquire return??
- return CORBA::B_TRUE;
-}
-
-void CC_Lock::unlock(void)
-{
- semaphore_.release();
-}
-
-void CC_Lock::change_mode(CosConcurrencyControl::lock_mode new_mode)
-{
- // @@TAO Hmmm, we cannot really do anything at present since there is
- // only one lock per lock set and that lock is essentially a write lock
-}
-
-CORBA::Boolean CC_Lock::Compatible(const CC_Lock &other)
-{
- return this->Compatible(other.mode_);
-}
-
-CORBA::Boolean CC_Lock::Compatible(CosConcurrencyControl::lock_mode mode)
-{
- return compatible_[this->mode_][mode];
-}
-
-CosConcurrencyControl::lock_mode CC_Lock::GetMode(void)
-{
- return mode_;
-}
-
-// The check of compatibility is a hard coded table statically allocated
-// This table must be changed if the number of lock modes or their
-// compatibility are changed. 5 = number of lock modes
-CORBA::Boolean CC_Lock::compatible_[5][5] ={
- {CORBA::B_TRUE, CORBA::B_TRUE, CORBA::B_TRUE, CORBA::B_TRUE, CORBA::B_FALSE},
- {CORBA::B_TRUE, CORBA::B_TRUE, CORBA::B_TRUE, CORBA::B_FALSE, CORBA::B_FALSE},
- {CORBA::B_TRUE, CORBA::B_TRUE, CORBA::B_FALSE, CORBA::B_FALSE, CORBA::B_FALSE},
- {CORBA::B_TRUE, CORBA::B_FALSE, CORBA::B_FALSE, CORBA::B_FALSE, CORBA::B_TRUE},
- {CORBA::B_FALSE, CORBA::B_FALSE, CORBA::B_FALSE, CORBA::B_FALSE, CORBA::B_FALSE}};
-
-//#if defined (__ACE_INLINE__)
-//#include "CC_Lock.i"
-//#endif // defined INLINE
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.h b/TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.h
deleted file mode 100644
index 249793df025..00000000000
--- a/TAO/orbsvcs/orbsvcs/Concurrency/CC_Lock.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/Concurrency_Service
-//
-// = FILENAME
-// CC_Lock.h
-//
-// = DESCRIPTION
-// This class implements a lock used by the lock set from the
-// concurrency control service
-//
-// = AUTHORS
-// Torben Worm <tworm@cs.wustl.edu>
-//
-// ============================================================================
-
-#if !defined (_CC_LOCK_H)
-#define _CC_LOCK_H
-
-#include "ace/SV_Semaphore_Simple.h"
-#include "orbsvcs/CosConcurrencyControlC.h"
-
-class TAO_ORBSVCS_Export CC_Lock {
- // = TITLE
- // CC_Lock
- //
- // = DESCRIPTION
- // This class implements the lock concept from the concurrency
- // control service. The lock holds its mode - this might later be
- // changed to subclasses depending on the differences of the locks.
- // At present the is only a lock-pr-thread/client-type which is
- // essentially a write lock since it is not allowed to have more
- // than one lock pr. servant in this implementation.
-public:
- CC_Lock(CosConcurrencyControl::lock_mode mode);
- // Creates the lock with the desired mode
-
- ~CC_Lock();
- // Deletes the lock
-
- void lock(void);
- // Acquires this lock. Blocks until lock is obtained
-
- CORBA::Boolean try_lock();
- // Tries to acquire this lock. If it is not possible to acquire the
- // lock, false is returned
-
- void unlock(void);
- // Releases this lock
-
- void change_mode(CosConcurrencyControl::lock_mode new_mode);
- // Changes the mode of this lock
-
- CORBA::Boolean Compatible(const CC_Lock &other);
- // returns true if this lock is compatible with the other lock
-
- CORBA::Boolean Compatible(CosConcurrencyControl::lock_mode mode);
- // returns true is this lock is compatible with the referenced mode
-
- CosConcurrencyControl::lock_mode GetMode(void);
- // Returns the mode of the lock
-protected:
- CosConcurrencyControl::lock_mode mode_;
- // Holds the lock's mode
-private:
- ACE_SV_Semaphore_Simple semaphore_;
- // holds the semaphore for this lock
- static CORBA::Boolean compatible_[5][5];
- // defines the compatibility of the locks. 5 = number of lock modes
-};
-
-//#if defined (__ACE_INLINE__)
-//#include "CC_Lock.i"
-//#endif // defined INLINE
-
-#endif /* !defined (_CC_LOCK_H) */
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.cpp b/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.cpp
deleted file mode 100644
index 0fe25901e2a..00000000000
--- a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- C++ -*- */
-
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// CC_LockSet.cpp
-//
-// = AUTHOR
-// Torben Worm <tworm@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "CC_LockSet.h"
-
-// Default constructor. We cannot create the lock at this point because we
-// are not locking anything, and we do not know the mode of the lock. In a
-// full fledged version the lock set (implementation) will be instantiated
-// here
-CC_LockSet::CC_LockSet(void)
- : related_lockset_ (0)
-{
- // Do nothing
-}
-
-// Constructor used to create related lock sets.
-CC_LockSet::CC_LockSet(CosConcurrencyControl::LockSet_ptr related)
- : related_lockset_ (related)
-{
- // Do nothing
-}
-
-// Destructor. Remove the lock if it exists. In a later version the lock set
-// must be removed here. Actually if all locks have been unlocked no lock
-// instances should exist at this point.
-CC_LockSet::~CC_LockSet(void)
-{
- if(lock_!=0)
- delete lock_;
-}
-
-// Locks the lock in the desired mode. Blocks until success. In a later
-// version the lock set should be searched for incompatible locks
-void CC_LockSet::lock(CosConcurrencyControl::lock_mode mode,
- CORBA::Environment &env)
-{
- if(lock==0) {
- lock_ = new CC_Lock(mode);
- }
- lock_->lock();
-}
-
-// Tries to lock. If it is not possible false is returned. Comments for lock
-// holds for later version
-CORBA::Boolean CC_LockSet::try_lock(CosConcurrencyControl::lock_mode mode,
- CORBA::Environment &env)
-{
- return lock_->try_lock();
-}
-
-// Drops the specified lock. In this simple case we have only one lock at
-// any time so we just drop that lock.
-void CC_LockSet::unlock(CosConcurrencyControl::lock_mode mode,
- CORBA::Environment &env)
-{
- lock_->unlock();
-}
-
-// Changes the mode of a held lock. In this version we deal with only
-// one type of lock (in reality) and therefore the type is of no meaning
-void CC_LockSet::change_mode (CosConcurrencyControl::lock_mode held_mode,
- CosConcurrencyControl::lock_mode new_mode,
- CORBA::Environment &env)
-{
- lock_->change_mode(new_mode);
-}
-
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.h b/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.h
deleted file mode 100644
index d158df6dc3a..00000000000
--- a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSet.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/Concurrency_Service
-//
-// = FILENAME
-// CC_LockSet.h
-//
-// = DESCRIPTION
-// This class implements the lock set interface from the
-// concurrency service
-//
-// = AUTHORS
-// Torben Worm <tworm@cs.wustl.edu>
-//
-// ============================================================================
-
-#if !defined (_CC_LOCKSET_H)
-#define _CC_LOCKSET_H
-
-// #include "tao/corba.h"
-#include "CC_Lock.h"
-#include "orbsvcs/CosConcurrencyControlS.h" // @@OR CosC...C.h???
-
-class TAO_ORBSVCS_Export CC_LockSet : public POA_CosConcurrencyControl::LockSet
- // = TITLE
- // CC_LockSet
- //
- // = DESCRIPTION
- // This class implements the LockSet interface that is part
- // of the CosConcurrency service. Please consult the idl file for
- // detailed descriptions apart from the comments in this file
-{
-public:
- CC_LockSet(void);
- // Default constructor
-
- CC_LockSet(CosConcurrencyControl::LockSet_ptr related);
- // Constructor used if create_related is used to create the lock set
-
- ~CC_LockSet(void);
- // Destructor
-
- virtual void lock (CosConcurrencyControl::lock_mode mode,
- CORBA::Environment &env);
-
- virtual CORBA::Boolean try_lock (CosConcurrencyControl::lock_mode mode,
- CORBA::Environment &env);
-
- virtual void unlock (CosConcurrencyControl::lock_mode mode,
- CORBA::Environment &env);
-
- virtual void change_mode (CosConcurrencyControl::lock_mode held_mode,
- CosConcurrencyControl::lock_mode new_mode,
- CORBA::Environment &env);
-private:
- CC_Lock *lock_;
- // At present the lock set contains only one lock
-
- CosConcurrencyControl::LockSet_ptr related_lockset_;
- // If this lock set is related to another lock set, this is the pointer
- // to the related lock set
-}; // CC_LockSet
-
-//#if defined (__ACE_INLINE__)
-//#include "CC_LockSet.i"
-//#endif // defined INLINE
-
-#endif /* _CC_LOCKSET_H */
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.cpp b/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.cpp
deleted file mode 100644
index f3d2a0c03a1..00000000000
--- a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- C++ -*- */
-
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// cos
-//
-// = FILENAME
-// CC_LockSetFactory.cpp
-//
-// = AUTHOR
-// Torben Worm <tworm@cs.wustl.edu>
-//
-// ============================================================================
-
-#include "CC_LockSetFactory.h"
-#include "CC_LockSet.h"
-
-// Default constructor
-CC_LockSetFactory::CC_LockSetFactory(void)
-{
- ACE_NEW(this->lock_, ACE_Lock_Adapter<ACE_Thread_Mutex> ());
-}
-
-// Destructor
-CC_LockSetFactory::~CC_LockSetFactory(void)
-{
- delete this->lock_;
-}
-
-CosConcurrencyControl::LockSet_ptr
- CC_LockSetFactory::create ( CORBA::Environment &env)
-{
- CC_LockSet *ls = 0;
-
- env.clear();
- env.exception(new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
- ACE_GUARD_RETURN(ACE_Lock, ace_mon, *this->lock_,
- CosConcurrencyControl::LockSet::_nil());
-
- env.clear();
-
- env.exception(new CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
- ACE_NEW_RETURN(ls, CC_LockSet, CosConcurrencyControl::LockSet::_nil());
- env.clear();
-
- return ls->_this(env);
-}
-
-CosConcurrencyControl::LockSet_ptr
- CC_LockSetFactory::create_related (CosConcurrencyControl::LockSet_ptr which,
- CORBA::Environment &env)
-{
- CC_LockSet *ls = 0;
-
- env.clear();
- env.exception(new CORBA::UNKNOWN (CORBA::COMPLETED_NO));
- ACE_GUARD_RETURN(ACE_Lock, ace_mon, *this->lock_,
- CosConcurrencyControl::LockSet::_nil());
-
- env.clear();
-
- env.exception(new CORBA::NO_MEMORY (CORBA::COMPLETED_NO));
- ACE_NEW_RETURN(ls, CC_LockSet(which),
- CosConcurrencyControl::LockSet::_nil());
- env.clear();
-
- return ls->_this(env);
-}
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.h b/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.h
deleted file mode 100644
index 819367452cc..00000000000
--- a/TAO/orbsvcs/orbsvcs/Concurrency/CC_LockSetFactory.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO/orbsvcs/Concurrency_Service
-//
-// = FILENAME
-// CC_LockSetFactory.h
-//
-// = DESCRIPTION
-// This class implements the lock set factory interface from the
-// concuurency service
-//
-// = AUTHORS
-// Torben Worm <tworm@cs.wustl.edu>
-//
-// ============================================================================
-
-#if !defined (_CC_LOCKSETFACTORY_H)
-#define _CC_LOCKSETFACTORY_H
-
-// #include "tao/corba.h"
-#include "orbsvcs/CosConcurrencyControlS.h"
-
-class TAO_ORBSVCS_Export CC_LockSetFactory : POA_CosConcurrencyControl::LockSetFactory
- // = TITLE
- // CC_LockSetFactory
- //
- // = DESCRIPTION
- // This class implements the LockSetFactory interface that is part
- // of the CosConcurrency service. Please consult the idl file for
- // detailed descriptions apart from the comments in this file
-{
-public:
- CC_LockSetFactory(void);
- // Default constructor
-
- ~CC_LockSetFactory(void);
- // Destructor
-
- virtual CosConcurrencyControl::LockSet_ptr create ( CORBA::Environment &env);
-
- virtual CosConcurrencyControl::LockSet_ptr
- create_related (CosConcurrencyControl::LockSet_ptr which,
- CORBA::Environment &env);
-private:
- ACE_Lock *lock_;
- // Lock to serialize the access to the factory.
-}; // CC_LockSetFactory
-
-//#if defined (__ACE_INLINE__)
-//#include "CC_LockSetFactory.i"
-//#endif // defined INLINE
-
-#endif /* _CC_LOCKSETFACTORY_H */