diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-10-05 21:50:01 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-10-05 21:50:01 +0000 |
commit | 6a4903bb0c6042fad1fbde354a4e9216781e1d5d (patch) | |
tree | 6d9df9533e4a7f1af523176b764d43221230863a /ace | |
parent | 691bc33f73ae0dda631c57a040119988df56c217 (diff) | |
download | ATCD-6a4903bb0c6042fad1fbde354a4e9216781e1d5d.tar.gz |
ChangeLogTag:Thu Oct 4 07:10:01 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Acceptor.h | 2 | ||||
-rw-r--r-- | ace/Caching_Utility_T.h | 1 | ||||
-rw-r--r-- | ace/Future.h | 1 | ||||
-rw-r--r-- | ace/Local_Name_Space_T.h | 7 | ||||
-rw-r--r-- | ace/Naming_Context.h | 4 | ||||
-rw-r--r-- | ace/Process_Mutex.cpp | 6 | ||||
-rw-r--r-- | ace/Process_Mutex.h | 11 | ||||
-rw-r--r-- | ace/RB_Tree.cpp | 32 | ||||
-rw-r--r-- | ace/RB_Tree.h | 11 | ||||
-rw-r--r-- | ace/RB_Tree.i | 51 | ||||
-rw-r--r-- | ace/RW_Process_Mutex.cpp | 11 | ||||
-rw-r--r-- | ace/RW_Process_Mutex.h | 12 | ||||
-rw-r--r-- | ace/Synch.h | 9 |
13 files changed, 87 insertions, 71 deletions
diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 10d03894bae..b1bbc3ea46e 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -6,7 +6,7 @@ * * $Id$ * - * @author Doug Schmidt <schmidt@cs.wustl.edu> + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= diff --git a/ace/Caching_Utility_T.h b/ace/Caching_Utility_T.h index 5a6ba2239cc..4a529627f20 100644 --- a/ace/Caching_Utility_T.h +++ b/ace/Caching_Utility_T.h @@ -10,7 +10,6 @@ */ //============================================================================= - #ifndef CACHING_UTILITY_H #define CACHING_UTILITY_H #include "ace/pre.h" diff --git a/ace/Future.h b/ace/Future.h index 4d5da0f034a..7027444b8a3 100644 --- a/ace/Future.h +++ b/ace/Future.h @@ -13,7 +13,6 @@ */ //============================================================================= - #ifndef ACE_FUTURE_H #define ACE_FUTURE_H #include "ace/pre.h" diff --git a/ace/Local_Name_Space_T.h b/ace/Local_Name_Space_T.h index 49360538e1c..c3891ec14b1 100644 --- a/ace/Local_Name_Space_T.h +++ b/ace/Local_Name_Space_T.h @@ -6,13 +6,12 @@ * * $Id$ * - * @author Prashant Jain (pjain@cs.wustl.edu) - * @author Irfan Pyarali (irfan@wuerl.wustl.edu) - * @author and Douglas C. Schmidt (schmidt@cs.wustl.edu). + * @author Prashant Jain <pjain@cs.wustl.edu> + * @author Irfan Pyarali <irfan@wuerl.wustl.edu> and + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= - #ifndef ACE_LOCAL_NAME_SPACE_T_H #define ACE_LOCAL_NAME_SPACE_T_H #include "ace/pre.h" diff --git a/ace/Naming_Context.h b/ace/Naming_Context.h index e06d190b189..4ffc94901c8 100644 --- a/ace/Naming_Context.h +++ b/ace/Naming_Context.h @@ -7,8 +7,8 @@ * $Id$ * * @author Gerhard Lenzer - * @author Douglas C. Schmidt - * @author and Prashant Jain + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + * @author and Prashant Jain <pjain@uci.edu> */ //============================================================================= diff --git a/ace/Process_Mutex.cpp b/ace/Process_Mutex.cpp index fa7cdce91b3..3930903967c 100644 --- a/ace/Process_Mutex.cpp +++ b/ace/Process_Mutex.cpp @@ -26,7 +26,7 @@ const ACE_TCHAR * ACE_Process_Mutex::unique_name (void) { // For all platforms other than Win32, we are going to create a - // machine wide unquie name if one is not provided by the user. On + // machine-wide unique name if one is not provided by the user. On // Win32, unnamed synchronization objects are acceptable. ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN); return this->name_; @@ -35,7 +35,7 @@ ACE_Process_Mutex::unique_name (void) ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg) #if defined (_ACE_USE_SV_SEM) - : lock_ (name ? ACE_TEXT_CHAR_TO_TCHAR (name) : ACE_Process_Mutex::unique_name ()) + : lock_ (name ? ACE_TEXT_CHAR_TO_TCHAR (name) :this->unique_name ()) #else : lock_ (USYNC_PROCESS, ACE_TEXT_CHAR_TO_TCHAR (name), (ACE_mutexattr_t *) arg) #endif /* _ACE_USE_SV_SEM */ @@ -48,7 +48,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg) #if defined (ACE_HAS_WCHAR) ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name, void *arg) #if defined (_ACE_USE_SV_SEM) - : lock_ (name ? ACE_TEXT_WCHAR_TO_TCHAR (name): ACE_Process_Mutex::unique_name ()) + : lock_ (name ? ACE_TEXT_WCHAR_TO_TCHAR (name): this->unique_name ()) #else : lock_ (USYNC_PROCESS, ACE_TEXT_WCHAR_TO_TCHAR (name), (ACE_mutexattr_t *) arg) #endif /* _ACE_USE_SV_SEM */ diff --git a/ace/Process_Mutex.h b/ace/Process_Mutex.h index 3c61b63ca5c..9b3fd1a67c9 100644 --- a/ace/Process_Mutex.h +++ b/ace/Process_Mutex.h @@ -6,13 +6,10 @@ * * $Id$ * - * A wrapper for mutexes that can be used across processes on - * the same host machine, as well as within a process, of - * course. + * A wrapper for mutexes that can be used across processes on the + * same host machine, as well as within a process, of course. * - * - * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> - */ + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= #ifndef ACE_PROCESS_MUTEX_H @@ -67,7 +64,7 @@ public: * * @param name optional, null-terminated string containing the name of * the object. Multiple users of the same @c ACE_Process_Mutex must use - * the same name to access the same object. If not specified, a name + * the same name to access the same object. If not specified, a name * is generated. * @param arg optional, attributes to be used to initialize the mutex. * If using @c ACE_SV_Semaphore_Complex as the underlying mechanism, diff --git a/ace/RB_Tree.cpp b/ace/RB_Tree.cpp index df3fa3836ea..91706c0e650 100644 --- a/ace/RB_Tree.cpp +++ b/ace/RB_Tree.cpp @@ -16,7 +16,7 @@ #include "ace/RB_Tree.i" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, RB_Tree, "$Id$") +ACE_RCSID(ace, RB_Tree, "$RB_Tree.cpp,v 1.26 2000/12/30 21:24:31 cdgill Exp$") // Constructor. @@ -39,12 +39,6 @@ template <class EXT_ID, class INT_ID> ACE_RB_Tree_Node<EXT_ID, INT_ID>::~ACE_RB_Tree_Node (void) { ACE_TRACE ("ACE_RB_Tree_Node<EXT_ID, INT_ID>::~ACE_RB_Tree_Node"); - - // Delete left sub-tree. - delete left_; - - // Delete right sub_tree. - delete right_; } // Constructor. @@ -524,7 +518,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::close_i () { ACE_TRACE ("ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::close_i"); - delete root_; + root_->operator delete (root_, allocator_); current_size_ = 0; root_ = 0; @@ -596,11 +590,11 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, { // The right subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; - ACE_NEW_RETURN (tmp, - (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), + (allocator_) (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), 0); - current->right (tmp); + + current->right (tmp); // If the node was successfully inserted, set its // parent, rebalance the tree, color the root black, and @@ -629,8 +623,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, // The left subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; ACE_NEW_RETURN (tmp, - (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), + (allocator_) (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), 0); + current->left (tmp); // If the node was successfully inserted, set its @@ -650,8 +645,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, // The tree is empty: insert at the root and color the root // black. ACE_NEW_RETURN (root_, - (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), + (allocator_) (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), 0); + if (root_) { root_->color (ACE_RB_Tree_Node_Base::BLACK); @@ -709,8 +705,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, // The right subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; ACE_NEW_RETURN (tmp, - (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), + (allocator_) (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), -1); + current->right (tmp); // If the node was successfully inserted, set its parent, rebalance @@ -740,7 +737,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, // The left subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; ACE_NEW_RETURN (tmp, - (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), + (allocator_) (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), -1); current->left (tmp); // If the node was successfully inserted, set its @@ -759,8 +756,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, { // The tree is empty: insert at the root and color the root black. ACE_NEW_RETURN (root_, - (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), + (allocator_) (ACE_RB_Tree_Node<EXT_ID, INT_ID>) (k, t), -1); + root_->color (ACE_RB_Tree_Node_Base::BLACK); ++current_size_; entry = root_; @@ -974,7 +972,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::remove_i (ACE_RB_Tree_Node< y->parent (0); y->right (0); y->left (0); - delete y; + y->operator delete (y, allocator_); --current_size_; return 0; diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h index 12e127f7a00..fa7492cbeee 100644 --- a/ace/RB_Tree.h +++ b/ace/RB_Tree.h @@ -6,11 +6,10 @@ * * $Id$ * - * @author Chris Gill + * @author Chris Gill <cdgill@cs.wustl.edu> */ //============================================================================= - #ifndef ACE_RB_TREE_H #define ACE_RB_TREE_H #include "ace/pre.h" @@ -90,6 +89,14 @@ public: /// Mutator for node's right child pointer void right (ACE_RB_Tree_Node<EXT_ID, INT_ID> * r); + // No-op, to avoid accident use. + void *operator new (size_t size); + // No-op, to avoid accident use. + void operator delete(void *p); + + void *operator new (size_t size, ACE_Allocator *allocator); + void operator delete(void *p, ACE_Allocator *allocator); + private: /// The key. diff --git a/ace/RB_Tree.i b/ace/RB_Tree.i index 4c463f14f94..c257e10da4c 100644 --- a/ace/RB_Tree.i +++ b/ace/RB_Tree.i @@ -18,7 +18,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::key () return k_; } - // Item accessor. template <class EXT_ID, class INT_ID> @@ -29,7 +28,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::item () return t_; } - // Set color of the node. template <class EXT_ID, class INT_ID> @@ -40,7 +38,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::color (ACE_RB_Tree_Node_Base::RB_Tree_Node_Col color_ = c; } - // Get color of the node. template <class EXT_ID, class INT_ID> @@ -51,7 +48,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::color () return color_; } - // Accessor for node's parent pointer. template <class EXT_ID, class INT_ID> @@ -62,7 +58,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::parent () return parent_; } - // Mutator for node's parent pointer. template <class EXT_ID, class INT_ID> @@ -73,8 +68,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::parent (ACE_RB_Tree_Node<EXT_ID, INT_ID> * p) parent_ = p; } - - // Accessor for node's left child pointer. template <class EXT_ID, class INT_ID> @@ -85,7 +78,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::left () return left_; } - // Mutator for node's left child pointer. template <class EXT_ID, class INT_ID> @@ -96,7 +88,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::left (ACE_RB_Tree_Node<EXT_ID, INT_ID> * l) left_ = l; } - // Accessor for node's right child pointer. template <class EXT_ID, class INT_ID> @@ -107,7 +98,6 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::right () return right_; } - // Mutator for node's right child pointer. template <class EXT_ID, class INT_ID> @@ -118,13 +108,30 @@ ACE_RB_Tree_Node<EXT_ID, INT_ID>::right (ACE_RB_Tree_Node<EXT_ID, INT_ID> * r) right_ = r; } +template <class EXT_ID, class INT_ID> +ACE_INLINE void * +ACE_RB_Tree_Node<EXT_ID, INT_ID>::operator new (size_t size, ACE_Allocator *allocator) +{ + return allocator->malloc (size); +} +template <class EXT_ID, class INT_ID> +ACE_INLINE void +ACE_RB_Tree_Node<EXT_ID, INT_ID>::operator delete(void *p, ACE_Allocator *allocator) +{ + if (p && allocator) + { + ACE_RB_Tree_Node<EXT_ID, INT_ID>* self = (ACE_RB_Tree_Node<EXT_ID, INT_ID>*)p; + operator delete (self->left_, allocator) ; + operator delete (self->right_, allocator) ; + allocator->free (p); + } +} //////////////////////////////////////////////////////////////////////// // template class ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> // //////////////////////////////////////////////////////////////////////// - // Initialize an RB Tree. template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> @@ -162,11 +169,10 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::close (void) return this->close_i (); } - // Associate <ext_id> with <int_id>. If <ext_id> is already in the // tree then the <ACE_RB_Tree_Node> is not changed. Returns 0 if a -// new entry is bound successfully, returns 1 if an attempt is made -// to bind an existing entry, and returns -1 if failures occur. +// new entry is bound successfully, returns 1 if an attempt is made to +// bind an existing entry, and returns -1 if failures occur. template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int @@ -180,9 +186,8 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id, return this->insert_i (ext_id, int_id, entry); } - -// Same as a normal bind, except the tree entry is also passed back -// to the caller. The entry in this case will either be the newly +// Same as a normal bind, except the tree entry is also passed back to +// the caller. The entry in this case will either be the newly // created entry, or the existing one. template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> @@ -198,12 +203,11 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::bind (const EXT_ID &ext_id, return this->insert_i (ext_id, int_id, entry); } - -// Associate <ext_id> with <int_id> if and only if <ext_id> is not -// in the tree. If <ext_id> is already in the tree then the <int_id> -// parameter is assigned the existing value in the tree. Returns 0 -// if a new entry is bound successfully, returns 1 if an attempt is -// made to bind an existing entry, and returns -1 if failures occur. +// Associate <ext_id> with <int_id> if and only if <ext_id> is not in +// the tree. If <ext_id> is already in the tree then the <int_id> +// parameter is assigned the existing value in the tree. Returns 0 if +// a new entry is bound successfully, returns 1 if an attempt is made +// to bind an existing entry, and returns -1 if failures occur. template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int @@ -224,7 +228,6 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::trybind (const EXT_ID &ext_ return result; } - // Same as a normal trybind, except the tree entry is also passed // back to the caller. The entry in this case will either be the // newly created entry, or the existing one. diff --git a/ace/RW_Process_Mutex.cpp b/ace/RW_Process_Mutex.cpp index e56c14a2787..4c763776afa 100644 --- a/ace/RW_Process_Mutex.cpp +++ b/ace/RW_Process_Mutex.cpp @@ -11,11 +11,18 @@ ACE_RCSID(ace, RW_Process_Mutex, "$Id$") ACE_ALLOC_HOOK_DEFINE(ACE_RW_Process_Mutex) +const ACE_TCHAR * +ACE_RW_Process_Mutex::unique_name (void) +{ + ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN); + return this->name_; +} + ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name, int flags) - : lock_ (name, flags + : lock_ (name ? name : this->unique_name ()), flags #if defined (ACE_WIN32) - ,ACE_DEFAULT_OPEN_PERMS) + , ACE_DEFAULT_OPEN_PERMS) #else , S_IRUSR | S_IWUSR) #endif /* ACE_WIN32 */ diff --git a/ace/RW_Process_Mutex.h b/ace/RW_Process_Mutex.h index 266938dab4f..77500d19aa3 100644 --- a/ace/RW_Process_Mutex.h +++ b/ace/RW_Process_Mutex.h @@ -6,11 +6,10 @@ * * $Id$ * - * @author Doug Schmidt + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= - #ifndef ACE_RW_PROCESS_MUTEX_H #define ACE_RW_PROCESS_MUTEX_H #include "ace/pre.h" @@ -36,7 +35,7 @@ class ACE_Export ACE_RW_Process_Mutex { public: /// Create a readers/writer <Process_Mutex>, passing in the optional - /// <name>. + /// <name>. If not specified, a name is generated. ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, int flags = O_CREAT|O_RDWR); @@ -96,6 +95,13 @@ public: ACE_ALLOC_HOOK_DECLARE; private: + /// If the user does not provide a name we generate a unique name in + /// this buffer. + ACE_TCHAR name_[ACE_UNIQUE_NAME_LEN]; + + /// Create and return the unique name. + const ACE_TCHAR *unique_name (void); + /// We need this to get the readers/writer semantics... ACE_File_Lock lock_; }; diff --git a/ace/Synch.h b/ace/Synch.h index 20d7ea972c7..b0ab02ae349 100644 --- a/ace/Synch.h +++ b/ace/Synch.h @@ -6,8 +6,7 @@ * * $Id$ * - * Wrappers for various synchronization routines. - * + * Wrapper Facades for various synchronization mechanisms. * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -199,7 +198,8 @@ public: * Therefore, if you're running on Solaris you might want to * consider using the ACE POSIX pthreads implementation instead, * which can be enabled by compiling ACE with - * -DACE_HAS_PTHREADS rather than -DACE_HAS_STHREADS. */ + * -DACE_HAS_PTHREADS, rather than -DACE_HAS_STHREADS or + * -DACE_HAS_POSIX_SEM. */ int acquire (ACE_Time_Value &tv); /** @@ -215,7 +215,8 @@ public: * Therefore, if you're running on Solaris you might want to * consider using the ACE POSIX pthreads implementation instead, * which can be enabled by compiling ACE with - * -DACE_HAS_PTHREADS rather than -DACE_HAS_STHREADS. */ + * -DACE_HAS_PTHREADS, rather than -DACE_HAS_STHREADS or + * -DACE_HAS_POSIX_SEM. */ int acquire (ACE_Time_Value *tv); /** |