diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-22 20:09:17 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-22 20:09:17 +0000 |
commit | 3c9e5dd3113c0c9e5c1bc8052ad63dd7456a9dea (patch) | |
tree | 6f7ea53bfb0c127dcc59c9c2543418779c657d81 | |
parent | bacbc8df7e6a56adc9c3dc128e7239417d1b30a2 (diff) | |
download | ATCD-3c9e5dd3113c0c9e5c1bc8052ad63dd7456a9dea.tar.gz |
Changed the mutex pointer in ACE_Locked_Freelist to just a regular
variable.
-rw-r--r-- | ace/Free_List.cpp | 31 | ||||
-rw-r--r-- | ace/Free_List.h | 17 | ||||
-rw-r--r-- | ace/Free_List.i | 6 |
3 files changed, 10 insertions, 44 deletions
diff --git a/ace/Free_List.cpp b/ace/Free_List.cpp index 9feeb85d475..53e6a9029ad 100644 --- a/ace/Free_List.cpp +++ b/ace/Free_List.cpp @@ -24,16 +24,13 @@ ACE_Locked_Free_List<T, LOCK>::ACE_Locked_Free_List (int mode, size_t prealloc, size_t lwm, size_t hwm, - size_t inc, - LOCK *mutex) + size_t inc) : mode_ (mode), free_list_ (NULL), lwm_ (lwm), hwm_ (hwm), inc_ (inc), - size_ (0), - mutex_ (mutex == 0 ? new LOCK : mutex), - delete_mutex_ (mutex == 0) + size_ (0) { this->alloc (prealloc); } @@ -50,9 +47,6 @@ ACE_Locked_Free_List<T, LOCK>::~ACE_Locked_Free_List (void) this->free_list_ = this->free_list_->get_next (); delete temp; } - - if (this->delete_mutex_) - delete this->mutex_; } // Allocates <n> extra nodes for the freelist @@ -60,7 +54,7 @@ ACE_Locked_Free_List<T, LOCK>::~ACE_Locked_Free_List (void) template <class T, class LOCK> void ACE_Locked_Free_List<T, LOCK>::alloc (size_t n) { - ACE_MT (ACE_GUARD (LOCK, ace_mon, *this->mutex_)); + ACE_MT (ACE_GUARD (LOCK, ace_mon, this->mutex_)); for (; n > 0; n--) { @@ -77,7 +71,7 @@ ACE_Locked_Free_List<T, LOCK>::alloc (size_t n) template <class T, class LOCK> void ACE_Locked_Free_List<T, LOCK>::dealloc (size_t n) { - ACE_MT (ACE_GUARD (LOCK, ace_mon, *this->mutex_)); + ACE_MT (ACE_GUARD (LOCK, ace_mon, this->mutex_)); for (; this->free_list_ != NULL && n > 0; n--) @@ -89,21 +83,4 @@ ACE_Locked_Free_List<T, LOCK>::dealloc (size_t n) } } -// returns a reference to the mutex. -template <class T, class LOCK> LOCK & -ACE_Locked_Free_List<T, LOCK>::get_mutex (void) -{ - return *this->mutex_; -} - -template <class T, class LOCK> void -ACE_Locked_Free_List<T, LOCK>::set_mutex (LOCK &mutex) -{ - if (this->delete_mutex_) - delete this->mutex_; - - this->mutex_ = &mutex; - this->delete_mutex_ = 0; -} - #endif /* ACE_FREE_LIST_C */ diff --git a/ace/Free_List.h b/ace/Free_List.h index f72581f6bc2..8f66b69d4c9 100644 --- a/ace/Free_List.h +++ b/ace/Free_List.h @@ -62,15 +62,13 @@ public: size_t prealloc = ACE_DEFAULT_FREE_LIST_PREALLOC, size_t lwm = ACE_DEFAULT_FREE_LIST_LWM, size_t hwm = ACE_DEFAULT_FREE_LIST_HWM, - size_t inc = ACE_DEFAULT_FREE_LIST_INC, - LOCK *mutex = 0); + size_t inc = ACE_DEFAULT_FREE_LIST_INC); // Constructor takes a <mode> (i.e., ACE_FREE_LIST_WITH_POOL or // ACE_PURE_FREE_LIST), a count of the number of nodes to // <prealloc>, a low and high water mark (<lwm> and <hwm>) that // indicate when to allocate more nodes, an increment value (<inc>) // that indicates how many nodes to allocate when the list must - // grow, and a pointer to a <mutex> that is used to determine the - // synchronization properties of the free list. + // grow. virtual ~ACE_Locked_Free_List (void); // Destructor - removes all the elements from the free_list. @@ -89,12 +87,6 @@ public: virtual void resize (size_t newsize); // Resizes the free list to <newsize>. - LOCK &get_mutex (void); - // Returns a reference to the mutex. - - void set_mutex (LOCK &mutex); - // Sets the mutex to <mutex>. - protected: virtual void alloc (size_t n); // Allocates <n> extra nodes for the freelist. @@ -121,12 +113,9 @@ protected: size_t size_; // Keeps track of the size of the list. - LOCK *mutex_; + LOCK mutex_; // Synchronization variable for <ACE_Timer_Queue>. - int delete_mutex_; - // flag to remember ownership of the mutex. - private: // = Don't allow these operations for now. ACE_Locked_Free_List (const ACE_Locked_Free_List<T, LOCK> &); diff --git a/ace/Free_List.i b/ace/Free_List.i index cda5dd45e9f..6f30a61eb33 100644 --- a/ace/Free_List.i +++ b/ace/Free_List.i @@ -7,7 +7,7 @@ template <class T, class LOCK> ACE_INLINE void ACE_Locked_Free_List<T, LOCK>::add (T *element) { - ACE_MT (ACE_GUARD (LOCK, ace_mon, *this->mutex_)); + ACE_MT (ACE_GUARD (LOCK, ace_mon, this->mutex_)); // Check to see that we not at the high water mark. if (this->mode_ == ACE_PURE_FREE_LIST || this->size_ >= this->hwm_) @@ -28,7 +28,7 @@ ACE_Locked_Free_List<T, LOCK>::add (T *element) template <class T, class LOCK> ACE_INLINE T* ACE_Locked_Free_List<T, LOCK>::remove (void) { - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, *this->mutex_, 0)); + ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, 0)); // If we are at the low water mark, add some nodes if (this->mode_ != ACE_PURE_FREE_LIST && this->size_ <= this->lwm_) @@ -61,7 +61,7 @@ ACE_Locked_Free_List<T, LOCK>::size (void) template <class T, class LOCK> ACE_INLINE void ACE_Locked_Free_List<T, LOCK>::resize (size_t newsize) { - ACE_MT (ACE_GUARD (LOCK, ace_mon, *this->mutex_)); + ACE_MT (ACE_GUARD (LOCK, ace_mon, this->mutex_)); // Check if we are allowed to resize if (this->mode_ != ACE_PURE_FREE_LIST) |