diff options
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | ace/Malloc_T.h | 22 | ||||
-rw-r--r-- | ace/Malloc_T.i | 2 | ||||
-rw-r--r-- | ace/Synch_T.cpp | 254 | ||||
-rw-r--r-- | ace/Synch_T.h | 157 | ||||
-rw-r--r-- | ace/Synch_T.i | 150 | ||||
-rw-r--r-- | ace/Timer_Queue_T.cpp | 68 | ||||
-rw-r--r-- | ace/Timer_Queue_T.h | 20 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Server_T.cpp | 12 |
9 files changed, 367 insertions, 319 deletions
@@ -523,6 +523,7 @@ Yigong Liu <ygl@emailbox.lucent.com> Erik Urdang <erik@bhi.com> Mike Schweiger <mikes@bmo.com> Anthony Mutiso <amutiso@hughes.cg.hac.com> +Jeff R. Hayes <Jeff.Hayes@osi.com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson and is now at ObjectSpace. Paul devised the recursive diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h index d33b7ca2b89..577865dae20 100644 --- a/ace/Malloc_T.h +++ b/ace/Malloc_T.h @@ -55,7 +55,7 @@ private: // back to hack this with casting. }; -template <class T, class LOCK> +template <class T, class ACE_LOCK> class ACE_Cached_Allocator : public ACE_New_Allocator { public: @@ -77,7 +77,7 @@ private: // remember how we allocate the memory in the first place so // we can clear things up later. - ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<T>, LOCK> free_list_; + ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<T>, ACE_LOCK> free_list_; // Maintain a cached memory free list. }; @@ -201,10 +201,10 @@ private: }; // Forward declaration. -template <ACE_MEM_POOL_1, class LOCK> +template <ACE_MEM_POOL_1, class ACE_LOCK> class ACE_Malloc_Iterator; -template <ACE_MEM_POOL_1, class LOCK> +template <ACE_MEM_POOL_1, class ACE_LOCK> class ACE_Malloc // = TITLE // Define a C++ class that uses parameterized types to provide @@ -213,10 +213,10 @@ class ACE_Malloc // // = DESCRIPTION // This class can be configured flexibly with different - // MEMORY_POOL strategies and different types of LOCK + // MEMORY_POOL strategies and different types of ACE_LOCK // strategies. { -friend class ACE_Malloc_Iterator<ACE_MEM_POOL_2, LOCK>; +friend class ACE_Malloc_Iterator<ACE_MEM_POOL_2, ACE_LOCK>; public: typedef ACE_MEM_POOL MEMORY_POOL; typedef ACE_MEM_POOL_OPTIONS MEMORY_POOL_OPTIONS; @@ -372,11 +372,11 @@ private: MEMORY_POOL memory_pool_; // Pool of memory used by ACE_Malloc - LOCK lock_; + ACE_LOCK lock_; // Local that ensures mutual exclusion. }; -template <ACE_MEM_POOL_1, class LOCK> +template <ACE_MEM_POOL_1, class ACE_LOCK> class ACE_Malloc_Iterator // = TITLE // Iterator for names stored in Malloc'd memory. @@ -386,7 +386,7 @@ class ACE_Malloc_Iterator { public: // = Initialization method. - ACE_Malloc_Iterator (ACE_Malloc<ACE_MEM_POOL_2, LOCK> &malloc, const char *name = 0); + ACE_Malloc_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc, const char *name = 0); // if <name> = 0 it will iterate through everything else only // through those entries whose <name> match @@ -417,13 +417,13 @@ public: // Declare the dynamic allocation hooks. private: - ACE_Malloc<ACE_MEM_POOL_2, LOCK> &malloc_; + ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc_; // Malloc we are iterating over. ACE_Name_Node *curr_; // Keeps track of how far we've advanced... - ACE_Read_Guard<LOCK> guard_; + ACE_Read_Guard<ACE_LOCK> guard_; // Lock Malloc for the lifetime of the iterator. const char *name_; diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i index 24285fd1239..526cbee0361 100644 --- a/ace/Malloc_T.i +++ b/ace/Malloc_T.i @@ -3,7 +3,7 @@ // Malloc_T.i -template <class T> T * ACE_INLINE +template <class T> ACE_INLINE T * ACE_Cached_Mem_Pool_Node<T>::addr (void) { return (T *) this; diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index caf70017067..e9dcc8099a3 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -14,32 +14,32 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) -template <class LOCK, class TYPE> -ACE_Test_and_Set<LOCK, TYPE>::ACE_Test_and_Set (TYPE initial_value) +template <class ACE_LOCK, class TYPE> +ACE_Test_and_Set<ACE_LOCK, TYPE>::ACE_Test_and_Set (TYPE initial_value) : is_set_ (initial_value) { } // Returns true if we are done, else false. -template <class LOCK, class TYPE> TYPE -ACE_Test_and_Set<LOCK, TYPE>::is_set (void) const +template <class ACE_LOCK, class TYPE> TYPE +ACE_Test_and_Set<ACE_LOCK, TYPE>::is_set (void) const { - ACE_GUARD_RETURN (LOCK, ace_mon, (LOCK &) this->lock_, this->is_set_); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, this->is_set_); return this->is_set_; } // Sets the <is_set_> status. -template <class LOCK, class TYPE> TYPE -ACE_Test_and_Set<LOCK, TYPE>::set (TYPE status) +template <class ACE_LOCK, class TYPE> TYPE +ACE_Test_and_Set<ACE_LOCK, TYPE>::set (TYPE status) { - ACE_GUARD_RETURN (LOCK, ace_mon, this->lock_, this->is_set_); + ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, this->is_set_); TYPE o_status = this->is_set_; this->is_set_ = status; return o_status; } -template <class LOCK, class TYPE> int -ACE_Test_and_Set<LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *) +template <class ACE_LOCK, class TYPE> int +ACE_Test_and_Set<ACE_LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *) { // By setting this to 1, we are "signaling" to anyone calling // <is_set> or or <set> that the "test and set" object is in the @@ -48,36 +48,36 @@ ACE_Test_and_Set<LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *) return 0; } -template <class LOCK, class TYPE> void -ACE_Atomic_Op<LOCK, TYPE>::dump (void) const +template <class ACE_LOCK, class TYPE> void +ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::dump"); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->lock_.dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class LOCK, class TYPE> -ACE_Atomic_Op<LOCK, TYPE>::ACE_Atomic_Op (void) +template <class ACE_LOCK, class TYPE> +ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (void) : value_ (0) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::ACE_Atomic_Op"); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); } -template <class LOCK, class TYPE> -ACE_Atomic_Op<LOCK, TYPE>::ACE_Atomic_Op (TYPE c) +template <class ACE_LOCK, class TYPE> +ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (TYPE c) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::ACE_Atomic_Op"); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); this->value_ = c; } ACE_ALLOC_HOOK_DEFINE(ACE_Guard) -template <class LOCK> void -ACE_Guard<LOCK>::dump (void) const +template <class ACE_LOCK> void +ACE_Guard<ACE_LOCK>::dump (void) const { -// ACE_TRACE ("ACE_Guard<LOCK>::dump"); +// ACE_TRACE ("ACE_Guard<ACE_LOCK>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "lock_ = %x\n", this->lock_)); @@ -87,20 +87,20 @@ ACE_Guard<LOCK>::dump (void) const ACE_ALLOC_HOOK_DEFINE(ACE_Write_Guard) -template <class LOCK> void -ACE_Write_Guard<LOCK>::dump (void) const +template <class ACE_LOCK> void +ACE_Write_Guard<ACE_LOCK>::dump (void) const { -// ACE_TRACE ("ACE_Write_Guard<LOCK>::dump"); - ACE_Guard<LOCK>::dump (); +// ACE_TRACE ("ACE_Write_Guard<ACE_LOCK>::dump"); + ACE_Guard<ACE_LOCK>::dump (); } ACE_ALLOC_HOOK_DEFINE(ACE_Read_Guard) -template <class LOCK> void -ACE_Read_Guard<LOCK>::dump (void) const +template <class ACE_LOCK> void +ACE_Read_Guard<ACE_LOCK>::dump (void) const { -// ACE_TRACE ("ACE_Read_Guard<LOCK>::dump"); - ACE_Guard<LOCK>::dump (); +// ACE_TRACE ("ACE_Read_Guard<ACE_LOCK>::dump"); + ACE_Guard<ACE_LOCK>::dump (); } #if defined (ACE_HAS_THREADS) @@ -461,10 +461,10 @@ ACE_TSS<TYPE>::ts_object (TYPE *new_ts_obj) ACE_ALLOC_HOOK_DEFINE(ACE_TSS_Guard) -template <class LOCK> void -ACE_TSS_Guard<LOCK>::dump (void) const +template <class ACE_LOCK> void +ACE_TSS_Guard<ACE_LOCK>::dump (void) const { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::dump"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, "key_ = %d", this->key_)); @@ -472,39 +472,39 @@ ACE_TSS_Guard<LOCK>::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class LOCK> void -ACE_TSS_Guard<LOCK>::init_key (void) +template <class ACE_LOCK> void +ACE_TSS_Guard<ACE_LOCK>::init_key (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::init_key"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::init_key"); this->key_ = ACE_OS::NULL_key; ACE_Thread::keycreate (&this->key_, #if defined (ACE_HAS_THR_C_DEST) &ACE_TSS_C_cleanup, #else - &ACE_TSS_Guard<LOCK>::cleanup, + &ACE_TSS_Guard<ACE_LOCK>::cleanup, #endif /* ACE_HAS_THR_C_DEST */ (void *) this); } -template <class LOCK> -ACE_TSS_Guard<LOCK>::ACE_TSS_Guard (void) +template <class ACE_LOCK> +ACE_TSS_Guard<ACE_LOCK>::ACE_TSS_Guard (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::ACE_TSS_Guard"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::ACE_TSS_Guard"); this->init_key (); } -template <class LOCK> int -ACE_TSS_Guard<LOCK>::release (void) +template <class ACE_LOCK> int +ACE_TSS_Guard<ACE_LOCK>::release (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::release"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::release"); - ACE_Guard<LOCK> *guard = 0; + ACE_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *)tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *)tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -512,17 +512,17 @@ ACE_TSS_Guard<LOCK>::release (void) return guard->release (); } -template <class LOCK> int -ACE_TSS_Guard<LOCK>::remove (void) +template <class ACE_LOCK> int +ACE_TSS_Guard<ACE_LOCK>::remove (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::remove"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::remove"); - ACE_Guard<LOCK> *guard = 0; + ACE_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *)tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *)tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -530,17 +530,17 @@ ACE_TSS_Guard<LOCK>::remove (void) return guard->remove (); } -template <class LOCK> -ACE_TSS_Guard<LOCK>::~ACE_TSS_Guard (void) +template <class ACE_LOCK> +ACE_TSS_Guard<ACE_LOCK>::~ACE_TSS_Guard (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::~ACE_TSS_Guard"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::~ACE_TSS_Guard"); - ACE_Guard<LOCK> *guard = 0; + ACE_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -552,46 +552,46 @@ ACE_TSS_Guard<LOCK>::~ACE_TSS_Guard (void) delete guard; } -template <class LOCK> void -ACE_TSS_Guard<LOCK>::cleanup (void *ptr) +template <class ACE_LOCK> void +ACE_TSS_Guard<ACE_LOCK>::cleanup (void *ptr) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::dump"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::dump"); // Destructor releases lock. - delete (ACE_Guard<LOCK> *) ptr; + delete (ACE_Guard<ACE_LOCK> *) ptr; } -template <class LOCK> -ACE_TSS_Guard<LOCK>::ACE_TSS_Guard (LOCK &lock, int block) +template <class ACE_LOCK> +ACE_TSS_Guard<ACE_LOCK>::ACE_TSS_Guard (ACE_LOCK &lock, int block) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::ACE_TSS_Guard"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::ACE_TSS_Guard"); this->init_key (); - ACE_Guard<LOCK> *guard; - ACE_NEW (guard, ACE_Guard<LOCK> (lock, block)); + ACE_Guard<ACE_LOCK> *guard; + ACE_NEW (guard, ACE_Guard<ACE_LOCK> (lock, block)); #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter; ACE_NEW (tss_adapter, ACE_TSS_Adapter ((void *) guard, - ACE_TSS_Guard<LOCK>::cleanup)); + ACE_TSS_Guard<ACE_LOCK>::cleanup)); ACE_Thread::setspecific (this->key_, (void *) tss_adapter); #else ACE_Thread::setspecific (this->key_, (void *) guard); #endif /* ACE_HAS_THR_C_DEST */ } -template <class LOCK> int -ACE_TSS_Guard<LOCK>::acquire (void) +template <class ACE_LOCK> int +ACE_TSS_Guard<ACE_LOCK>::acquire (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::acquire"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::acquire"); - ACE_Guard<LOCK> *guard = 0; + ACE_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -599,17 +599,17 @@ ACE_TSS_Guard<LOCK>::acquire (void) return guard->acquire (); } -template <class LOCK> int -ACE_TSS_Guard<LOCK>::tryacquire (void) +template <class ACE_LOCK> int +ACE_TSS_Guard<ACE_LOCK>::tryacquire (void) { -// ACE_TRACE ("ACE_TSS_Guard<LOCK>::tryacquire"); +// ACE_TRACE ("ACE_TSS_Guard<ACE_LOCK>::tryacquire"); - ACE_Guard<LOCK> *guard = 0; + ACE_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -617,37 +617,37 @@ ACE_TSS_Guard<LOCK>::tryacquire (void) return guard->tryacquire (); } -template <class LOCK> -ACE_TSS_Write_Guard<LOCK>::ACE_TSS_Write_Guard (LOCK &lock, int block) +template <class ACE_LOCK> +ACE_TSS_Write_Guard<ACE_LOCK>::ACE_TSS_Write_Guard (ACE_LOCK &lock, int block) { -// ACE_TRACE ("ACE_TSS_Write_Guard<LOCK>::ACE_TSS_Write_Guard"); +// ACE_TRACE ("ACE_TSS_Write_Guard<ACE_LOCK>::ACE_TSS_Write_Guard"); this->init_key (); - ACE_Guard<LOCK> *guard; - ACE_NEW (guard, ACE_Write_Guard<LOCK> (lock, block)); + ACE_Guard<ACE_LOCK> *guard; + ACE_NEW (guard, ACE_Write_Guard<ACE_LOCK> (lock, block)); #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter; ACE_NEW (tss_adapter, ACE_TSS_Adapter ((void *) guard, - ACE_TSS_Guard<LOCK>::cleanup)); + ACE_TSS_Guard<ACE_LOCK>::cleanup)); ACE_Thread::setspecific (this->key_, (void *) tss_adapter); #else ACE_Thread::setspecific (this->key_, (void *) guard); #endif /* ACE_HAS_THR_C_DEST */ } -template <class LOCK> int -ACE_TSS_Write_Guard<LOCK>::acquire (void) +template <class ACE_LOCK> int +ACE_TSS_Write_Guard<ACE_LOCK>::acquire (void) { -// ACE_TRACE ("ACE_TSS_Write_Guard<LOCK>::acquire"); +// ACE_TRACE ("ACE_TSS_Write_Guard<ACE_LOCK>::acquire"); - ACE_Write_Guard<LOCK> *guard = 0; + ACE_Write_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -655,17 +655,17 @@ ACE_TSS_Write_Guard<LOCK>::acquire (void) return guard->acquire_write (); } -template <class LOCK> int -ACE_TSS_Write_Guard<LOCK>::tryacquire (void) +template <class ACE_LOCK> int +ACE_TSS_Write_Guard<ACE_LOCK>::tryacquire (void) { -// ACE_TRACE ("ACE_TSS_Write_Guard<LOCK>::tryacquire"); +// ACE_TRACE ("ACE_TSS_Write_Guard<ACE_LOCK>::tryacquire"); - ACE_Write_Guard<LOCK> *guard = 0; + ACE_Write_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -673,60 +673,60 @@ ACE_TSS_Write_Guard<LOCK>::tryacquire (void) return guard->tryacquire_write (); } -template <class LOCK> int -ACE_TSS_Write_Guard<LOCK>::acquire_write (void) +template <class ACE_LOCK> int +ACE_TSS_Write_Guard<ACE_LOCK>::acquire_write (void) { -// ACE_TRACE ("ACE_TSS_Write_Guard<LOCK>::acquire_write"); +// ACE_TRACE ("ACE_TSS_Write_Guard<ACE_LOCK>::acquire_write"); return this->acquire (); } -template <class LOCK> int -ACE_TSS_Write_Guard<LOCK>::tryacquire_write (void) +template <class ACE_LOCK> int +ACE_TSS_Write_Guard<ACE_LOCK>::tryacquire_write (void) { -// ACE_TRACE ("ACE_TSS_Write_Guard<LOCK>::tryacquire_write"); +// ACE_TRACE ("ACE_TSS_Write_Guard<ACE_LOCK>::tryacquire_write"); return this->tryacquire (); } -template <class LOCK> void -ACE_TSS_Write_Guard<LOCK>::dump (void) const +template <class ACE_LOCK> void +ACE_TSS_Write_Guard<ACE_LOCK>::dump (void) const { -// ACE_TRACE ("ACE_TSS_Write_Guard<LOCK>::dump"); - ACE_TSS_Guard<LOCK>::dump (); +// ACE_TRACE ("ACE_TSS_Write_Guard<ACE_LOCK>::dump"); + ACE_TSS_Guard<ACE_LOCK>::dump (); } -template <class LOCK> -ACE_TSS_Read_Guard<LOCK>::ACE_TSS_Read_Guard (LOCK &lock, int block) +template <class ACE_LOCK> +ACE_TSS_Read_Guard<ACE_LOCK>::ACE_TSS_Read_Guard (ACE_LOCK &lock, int block) { -// ACE_TRACE ("ACE_TSS_Read_Guard<LOCK>::ACE_TSS_Read_Guard"); +// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::ACE_TSS_Read_Guard"); this->init_key (); - ACE_Guard<LOCK> *guard; - ACE_NEW (guard, ACE_Read_Guard<LOCK> (lock, block)); + ACE_Guard<ACE_LOCK> *guard; + ACE_NEW (guard, ACE_Read_Guard<ACE_LOCK> (lock, block)); #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter; ACE_NEW (tss_adapter, ACE_TSS_Adapter ((void *)guard, - ACE_TSS_Guard<LOCK>::cleanup)); + ACE_TSS_Guard<ACE_LOCK>::cleanup)); ACE_Thread::setspecific (this->key_, (void *) tss_adapter); #else ACE_Thread::setspecific (this->key_, (void *) guard); #endif /* ACE_HAS_THR_C_DEST */ } -template <class LOCK> int -ACE_TSS_Read_Guard<LOCK>::acquire (void) +template <class ACE_LOCK> int +ACE_TSS_Read_Guard<ACE_LOCK>::acquire (void) { -// ACE_TRACE ("ACE_TSS_Read_Guard<LOCK>::acquire"); +// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::acquire"); - ACE_Read_Guard<LOCK> *guard = 0; + ACE_Read_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *)tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *)tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -734,17 +734,17 @@ ACE_TSS_Read_Guard<LOCK>::acquire (void) return guard->acquire_read (); } -template <class LOCK> int -ACE_TSS_Read_Guard<LOCK>::tryacquire (void) +template <class ACE_LOCK> int +ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire (void) { -// ACE_TRACE ("ACE_TSS_Read_Guard<LOCK>::tryacquire"); +// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire"); - ACE_Read_Guard<LOCK> *guard = 0; + ACE_Read_Guard<ACE_LOCK> *guard = 0; #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; ACE_Thread::getspecific (this->key_, (void **) &tss_adapter); - guard = (ACE_Guard<LOCK> *) tss_adapter->ts_obj_; + guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; #else ACE_Thread::getspecific (this->key_, (void **) &guard); #endif /* ACE_HAS_THR_C_DEST */ @@ -752,27 +752,27 @@ ACE_TSS_Read_Guard<LOCK>::tryacquire (void) return guard->tryacquire_read (); } -template <class LOCK> int -ACE_TSS_Read_Guard<LOCK>::acquire_read (void) +template <class ACE_LOCK> int +ACE_TSS_Read_Guard<ACE_LOCK>::acquire_read (void) { -// ACE_TRACE ("ACE_TSS_Read_Guard<LOCK>::acquire_read"); +// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::acquire_read"); return this->acquire (); } -template <class LOCK> int -ACE_TSS_Read_Guard<LOCK>::tryacquire_read (void) +template <class ACE_LOCK> int +ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire_read (void) { -// ACE_TRACE ("ACE_TSS_Read_Guard<LOCK>::tryacquire_read"); +// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire_read"); return this->tryacquire (); } -template <class LOCK> void -ACE_TSS_Read_Guard<LOCK>::dump (void) const +template <class ACE_LOCK> void +ACE_TSS_Read_Guard<ACE_LOCK>::dump (void) const { -// ACE_TRACE ("ACE_TSS_Read_Guard<LOCK>::dump"); - ACE_TSS_Guard<LOCK>::dump (); +// ACE_TRACE ("ACE_TSS_Read_Guard<ACE_LOCK>::dump"); + ACE_TSS_Guard<ACE_LOCK>::dump (); } #endif /* defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) */ diff --git a/ace/Synch_T.h b/ace/Synch_T.h index 2c0f423925f..8c1f142f7fd 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -23,7 +23,7 @@ // Forward decl class ACE_Time_Value; -template <class LOCKING_MECHANISM> +template <class ACE_LOCKING_MECHANISM> class ACE_Lock_Adapter : public ACE_Lock // = TITLE @@ -37,11 +37,9 @@ class ACE_Lock_Adapter : public ACE_Lock // This class uses a form of the Adapter pattern. { public: - typedef LOCKING_MECHANISM LOCK; - - virtual int remove (void); - // Explicitly destroy the lock. + typedef ACE_LOCKING_MECHANISM ACE_LOCK; + // = Lock accessors. virtual int acquire (void); // Block the thread until the lock is acquired. @@ -69,12 +67,15 @@ public: // Conditionally acquire a write lock. If the locking mechanism // doesn't support read locks then this just calls <acquire>. + virtual int remove (void); + // Explicitly destroy the lock. + private: - LOCKING_MECHANISM lock_; + ACE_LOCKING_MECHANISM lock_; // The concrete locking mechanism that all the methods delegate to. }; -template <class LOCK, class TYPE> +template <class ACE_LOCK, class TYPE> class ACE_Test_and_Set : public ACE_Event_Handler { // = TITLE @@ -107,11 +108,11 @@ private: TYPE is_set_; // Keeps track of our state. - LOCK lock_; + ACE_LOCK lock_; // Protect the state from race conditions. }; -template <class LOCK, class TYPE> +template <class ACE_LOCK, class TYPE> class ACE_Atomic_Op // = TITLE // Transparently parameterizes synchronization into basic @@ -123,12 +124,16 @@ class ACE_Atomic_Op // templatized version of the Decorator pattern from the GoF book. { public: + // = Initialization methods. + ACE_Atomic_Op (void); // Initialize <count_> to 0. ACE_Atomic_Op (TYPE c); // Initialize <count_> to c. + // = Accessors. + TYPE operator++ (void); // Atomically pre-increment <count_>. @@ -165,7 +170,7 @@ public: void operator= (const TYPE i); // Atomically assign rhs to <count_>. - void operator= (const ACE_Atomic_Op<LOCK, TYPE> &rhs); + void operator= (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs); // Atomically assign <rhs> to <count_>. operator TYPE () const; @@ -177,11 +182,11 @@ public: // ACE_ALLOC_HOOK_DECLARE; // Declare the dynamic allocation hooks. - ACE_Atomic_Op (const ACE_Atomic_Op<LOCK, TYPE> &); + ACE_Atomic_Op (const ACE_Atomic_Op<ACE_LOCK, TYPE> &); // Manage copying... private: - LOCK lock_; + ACE_LOCK lock_; // Type of synchronization mechanism. TYPE value_; @@ -202,6 +207,8 @@ class ACE_TSS // thread-specific storage. { public: + // = Initialization and termination methods. + ACE_TSS (TYPE *ts_obj = 0); // If caller has passed us a non-NULL ts_obj *, then we'll just use // this to initialize the thread-specific value. Thus, subsequent @@ -212,6 +219,8 @@ public: virtual ~ACE_TSS (void); // Deregister with thread-key administration. + // = Accessors. + TYPE *ts_object (void) const; // Get the thread-specific object for the key associated with this // object. Returns 0 if the data has never been initialized, @@ -232,6 +241,8 @@ public: virtual TYPE *make_TSS_TYPE (void) const; // hook for construction parameters. + // = Utility methods. + void dump (void) const; // Dump the state of an object. @@ -284,20 +295,21 @@ public: #define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition_Mutex #endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ -template <class LOCK> +template <class ACE_LOCK> class ACE_Guard // = TITLE // This data structure is meant to be used within a method or // function... It performs automatic aquisition and release of - // a parameterized synchronization object <LOCK>. + // a parameterized synchronization object <ACE_LOCK>. // // = DESCRIPTION - // The <LOCK> class given as an actual parameter must provide at + // The <ACE_LOCK> class given as an actual parameter must provide at // the very least the <acquire>, <tryacquire>, <release>, and // <remove> methods. { public: - ACE_Guard (LOCK &l, int block = 1): lock_ (&l) + // = Initialization and termination methods. + ACE_Guard (ACE_LOCK &l, int block = 1): lock_ (&l) { this->owner_ = block ? this->acquire () : this->tryacquire (); } @@ -307,12 +319,7 @@ public: ~ACE_Guard (void) { if (this->owner_ != -1) this->release (); } // Implicitly release the lock. - int locked (void) { return this->owner_ != -1; } - // 1 if locked, 0 if couldn't acquire the lock - // (errno will contain the reason for this). - - int remove (void) { return this->release (); } - // Explicitly release the lock. + // = Lock accessors. int acquire (void) { return this->owner_ = this->lock_->acquire (); } // Explicitly acquire the lock. @@ -332,6 +339,14 @@ public: } // Explicitly release the lock, but only if it is held! + // = Utility methods. + int locked (void) { return this->owner_ != -1; } + // 1 if locked, 0 if couldn't acquire the lock + // (errno will contain the reason for this). + + int remove (void) { return this->release (); } + // Explicitly release the lock. + void dump (void) const; // Dump the state of an object. @@ -339,37 +354,41 @@ public: // Declare the dynamic allocation hooks. protected: - ACE_Guard (LOCK *lock): lock_ (lock) {} + ACE_Guard (ACE_LOCK *lock): lock_ (lock) {} // Helper, meant for subclass only. - LOCK *lock_; - // Pointer to the LOCK we're guarding. + ACE_LOCK *lock_; + // Pointer to the ACE_LOCK we're guarding. int owner_; // Keeps track of whether we acquired the lock or failed. private: // = Prevent assignment and initialization. - void operator= (const ACE_Guard<LOCK> &); - ACE_Guard (const ACE_Guard<LOCK> &); + void operator= (const ACE_Guard<ACE_LOCK> &); + ACE_Guard (const ACE_Guard<ACE_LOCK> &); }; -template <class LOCK> -class ACE_Write_Guard : public ACE_Guard<LOCK> +template <class ACE_LOCK> +class ACE_Write_Guard : public ACE_Guard<ACE_LOCK> // = TITLE // This class is similar to class <ACE_Guard>, though it // acquires/releases a write lock automatically (naturally, the - // <LOCK> it is instantiated with must support the appropriate + // <ACE_LOCK> it is instantiated with must support the appropriate // API). { public: - ACE_Write_Guard (LOCK &m, int block = 1): ACE_Guard<LOCK> (&m) + // = Initialization method. + + ACE_Write_Guard (ACE_LOCK &m, int block = 1): ACE_Guard<ACE_LOCK> (&m) { this->owner_ = block ? this->acquire_write () : this->tryacquire_write (); } // Implicitly and automatically acquire (or try to acquire) a write // lock. + // = Lock accessors. + int acquire_write (void) { return this->owner_ = this->lock_->acquire_write (); } // Explicitly acquire the write lock. @@ -382,6 +401,8 @@ public: int tryacquire (void) { return this->owner_ = this->lock_->tryacquire_write (); } // Conditionally acquire the write lock (i.e., won't block). + // Utility methods. + void dump (void) const; // Dump the state of an object. @@ -389,22 +410,26 @@ public: // Declare the dynamic allocation hooks. }; -template <class LOCK> -class ACE_Read_Guard : public ACE_Guard<LOCK> +template <class ACE_LOCK> +class ACE_Read_Guard : public ACE_Guard<ACE_LOCK> // = TITLE // This class is similar to class <ACE_Guard>, though it // acquires/releases a read lock automatically (naturally, the - // <LOCK> it is instantiated with must support the appropriate + // <ACE_LOCK> it is instantiated with must support the appropriate // API). { public: - ACE_Read_Guard (LOCK &m, int block = 1): ACE_Guard<LOCK> (&m) + // = Initialization methods. + + ACE_Read_Guard (ACE_LOCK &m, int block = 1): ACE_Guard<ACE_LOCK> (&m) { this->owner_ = block ? this->acquire_read () : this->tryacquire_read (); } // Implicitly and automatically acquire (or try to acquire) a read // lock. + // = Lock accessors. + int acquire_read (void) { return this->owner_ = this->lock_->acquire_read (); } // Explicitly acquire the read lock. @@ -417,6 +442,8 @@ public: int tryacquire (void) { return this->owner_ = this->lock_->tryacquire_read (); } // Conditionally acquire the read lock (i.e., won't block). + // = Utility methods. + void dump (void) const; // Dump the state of an object. @@ -433,7 +460,7 @@ public: #else /* ACE platform supports some form of threading and */ // thread-specific storage. -template <class LOCK> +template <class ACE_LOCK> class ACE_TSS_Guard // = TITLE // This data structure is meant to be used within a method or @@ -442,14 +469,15 @@ class ACE_TSS_Guard // is released even if a thread exits via "thr_exit()"! { public: - ACE_TSS_Guard (LOCK &lock, int block = 1); + // = Initialization and termination methods. + + ACE_TSS_Guard (ACE_LOCK &lock, int block = 1); // Implicitly and automatically acquire the thread-specific lock. ~ACE_TSS_Guard (void); // Implicitly release the thread-specific lock. - int remove (void); - // Explicitly release the thread-specific lock. + // = Lock accessors. int acquire (void); // Explicitly acquire the thread-specific lock. @@ -461,6 +489,10 @@ public: int release (void); // Explicitly release the thread-specific lock. + // = Utility methods. + int remove (void); + // Explicitly release the thread-specific lock. + void dump (void) const; // Dump the state of an object. @@ -482,22 +514,26 @@ protected: private: // = Prevent assignment and initialization. - void operator= (const ACE_TSS_Guard<LOCK> &); - ACE_TSS_Guard (const ACE_TSS_Guard<LOCK> &); + void operator= (const ACE_TSS_Guard<ACE_LOCK> &); + ACE_TSS_Guard (const ACE_TSS_Guard<ACE_LOCK> &); }; -template <class LOCK> -class ACE_TSS_Write_Guard : public ACE_TSS_Guard<LOCK> +template <class ACE_LOCK> +class ACE_TSS_Write_Guard : public ACE_TSS_Guard<ACE_LOCK> // = TITLE // This class is similar to class ACE_TSS_Guard, though it // acquires/releases a write-lock automatically (naturally, the - // LOCK it is instantiated with must support the appropriate + // ACE_LOCK it is instantiated with must support the appropriate // API). { public: - ACE_TSS_Write_Guard (LOCK &lock, int block = 1); + // = Initialization method. + + ACE_TSS_Write_Guard (ACE_LOCK &lock, int block = 1); // Implicitly and automatically acquire the thread-specific write lock. + // = Lock accessors. + int acquire_write (void); // Explicitly acquire the thread-specific write lock. @@ -510,6 +546,8 @@ public: int tryacquire (void); // Conditionally acquire the thread-specific write lock (i.e., won't block). + // = Utility methods. + void dump (void) const; // Dump the state of an object. @@ -517,18 +555,20 @@ public: // Declare the dynamic allocation hooks. }; -template <class LOCK> -class ACE_TSS_Read_Guard : public ACE_TSS_Guard<LOCK> +template <class ACE_LOCK> +class ACE_TSS_Read_Guard : public ACE_TSS_Guard<ACE_LOCK> // = TITLE // This class is similar to class <ACE_TSS_Guard>, though it // acquires/releases a read lock automatically (naturally, the - // <LOCK> it is instantiated with must support the appropriate - // API). + // <ACE_LOCK> it is instantiated with must support the + // appropriate API). { public: - ACE_TSS_Read_Guard (LOCK &lock, int block = 1); + // = Initialization method. + ACE_TSS_Read_Guard (ACE_LOCK &lock, int block = 1); // Implicitly and automatically acquire the thread-specific read lock. + // = Lock accessors. int acquire_read (void); // Explicitly acquire the thread-specific read lock. @@ -536,11 +576,14 @@ public: // Explicitly acquire the thread-specific read lock. int tryacquire_read (void); - // Conditionally acquire the thread-specific read lock (i.e., won't block). + // Conditionally acquire the thread-specific read lock (i.e., won't + // block). int tryacquire (void); - // Conditionally acquire the thread-specific read lock (i.e., won't block). + // Conditionally acquire the thread-specific read lock (i.e., won't + // block). + // = Utility methods. void dump (void) const; // Dump the state of an object. @@ -571,6 +614,7 @@ class ACE_Condition // { public: + // = Initialiation and termination methods. ACE_Condition (MUTEX &m, int type = USYNC_THREAD, LPCTSTR name = 0, void *arg = 0); // Initialize the condition variable. @@ -578,9 +622,7 @@ public: ~ACE_Condition (void); // Implicitly destroy the condition variable. - int remove (void); - // Explicitly destroy the condition variable. - + // = Lock accessors. int wait (const ACE_Time_Value *abstime); // Block on condition, or until absolute time-of-day has passed. If // abstime == 0 use "blocking" <wait> semantics. Else, if <abstime> @@ -604,6 +646,10 @@ public: int broadcast (void); // Signal *all* waiting threads. + // = Utility methods. + int remove (void); + // Explicitly destroy the condition variable. + MUTEX &mutex (void); // Returns a reference to the underlying mutex_; @@ -645,6 +691,7 @@ class ACE_Thread_Condition : public ACE_Condition<MUTEX> // { public: + // = Initialization method. ACE_Thread_Condition (MUTEX &m, LPCTSTR name = 0, void *arg = 0); void dump (void) const; diff --git a/ace/Synch_T.i b/ace/Synch_T.i index 336a0805b1c..1c0cafef31d 100644 --- a/ace/Synch_T.i +++ b/ace/Synch_T.i @@ -6,31 +6,31 @@ #include "ace/Thread.h" // Explicitly destroy the lock. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::remove (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::remove (void) { return this->lock_.remove (); } // Block the thread until the lock is acquired. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::acquire (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::acquire (void) { return this->lock_.acquire (); } // Conditionally acquire the lock (i.e., won't block). -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::tryacquire (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::tryacquire (void) { return this->lock_.tryacquire (); } // Release the lock. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::release (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::release (void) { return this->lock_.release (); } @@ -39,8 +39,8 @@ ACE_Lock_Adapter<LOCKING_MECHANISM>::release (void) // mechanism doesn't support read locks then this just calls // <acquire>. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::acquire_read (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::acquire_read (void) { return this->lock_.acquire_read (); } @@ -49,8 +49,8 @@ ACE_Lock_Adapter<LOCKING_MECHANISM>::acquire_read (void) // mechanism doesn't support read locks then this just calls // <acquire>. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::acquire_write (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::acquire_write (void) { return this->lock_.acquire_write (); } @@ -58,8 +58,8 @@ ACE_Lock_Adapter<LOCKING_MECHANISM>::acquire_write (void) // Conditionally acquire a read lock. If the locking mechanism // doesn't support read locks then this just calls <acquire>. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::tryacquire_read (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::tryacquire_read (void) { return this->lock_.tryacquire_read (); } @@ -67,132 +67,132 @@ ACE_Lock_Adapter<LOCKING_MECHANISM>::tryacquire_read (void) // Conditionally acquire a write lock. If the locking mechanism // doesn't support write locks then this just calls <acquire>. -template <class LOCKING_MECHANISM> ACE_INLINE int -ACE_Lock_Adapter<LOCKING_MECHANISM>::tryacquire_write (void) +template <class ACE_LOCKING_MECHANISM> ACE_INLINE int +ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::tryacquire_write (void) { return this->lock_.tryacquire_write (); } -template <class LOCK, class TYPE> ACE_INLINE -ACE_Atomic_Op<LOCK, TYPE>::ACE_Atomic_Op (const ACE_Atomic_Op<LOCK, TYPE> &rhs) +template <class ACE_LOCK, class TYPE> ACE_INLINE +ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::ACE_Atomic_Op"); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); *this = rhs; // Invoke the assignment operator. } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator++ (void) +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (void) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator++"); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++"); + ACE_Guard<ACE_LOCK> m (this->lock_); return ++this->value_; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator++ (int) +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (int) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator++"); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++"); + ACE_Guard<ACE_LOCK> m (this->lock_); return this->value_++; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator+= (const TYPE i) +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (const TYPE i) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator+="); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+="); + ACE_Guard<ACE_LOCK> m (this->lock_); return this->value_ += i; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator-- (void) +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (void) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator--"); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator--"); + ACE_Guard<ACE_LOCK> m (this->lock_); return --this->value_; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator-- (int) +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (int) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator--"); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator--"); + ACE_Guard<ACE_LOCK> m (this->lock_); return this->value_--; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator-= (const TYPE i) +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (const TYPE i) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator-="); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-="); + ACE_Guard<ACE_LOCK> m (this->lock_); return this->value_ -= i; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator== (const TYPE i) const +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (const TYPE i) const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator=="); - ACE_Guard<LOCK> m ((LOCK &) this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator=="); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return this->value_ == i; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator>= (const TYPE i) const +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (const TYPE i) const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator>="); - ACE_Guard<LOCK> m ((LOCK &) this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>="); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return this->value_ >= i; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator> (const TYPE rhs) const +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (const TYPE rhs) const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator>"); - ACE_Guard<LOCK> m ((LOCK &) this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>"); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return this->value_ > rhs; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator<= (const TYPE rhs) const +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (const TYPE rhs) const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator<="); - ACE_Guard<LOCK> m ((LOCK &) this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<="); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return this->value_ <= rhs; } -template <class LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<LOCK, TYPE>::operator< (const TYPE rhs) const +template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (const TYPE rhs) const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator<"); - ACE_Guard<LOCK> m ((LOCK &) this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<"); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return this->value_ < rhs; } -template <class LOCK, class TYPE> void -ACE_Atomic_Op<LOCK, TYPE>::operator= (const ACE_Atomic_Op<LOCK, TYPE> &rhs) +template <class ACE_LOCK, class TYPE> void +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator="); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator="); if (&rhs == this) return; // Avoid deadlock... - ACE_Guard<LOCK> m (this->lock_); + ACE_Guard<ACE_LOCK> m (this->lock_); // This will call ACE_Atomic_Op::TYPE(), which will ensure the value // of <rhs> is acquired atomically. this->value_ = rhs; } -template <class LOCK, class TYPE> ACE_INLINE -ACE_Atomic_Op<LOCK, TYPE>::operator TYPE () const +template <class ACE_LOCK, class TYPE> ACE_INLINE +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator TYPE () const { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator TYPE"); - ACE_Guard<LOCK> m ((LOCK &) this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator TYPE"); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return this->value_; } -template <class LOCK, class TYPE> ACE_INLINE void -ACE_Atomic_Op<LOCK, TYPE>::operator= (const TYPE i) +template <class ACE_LOCK, class TYPE> ACE_INLINE void +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const TYPE i) { -// ACE_TRACE ("ACE_Atomic_Op<LOCK, TYPE>::operator="); - ACE_Guard<LOCK> m (this->lock_); +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator="); + ACE_Guard<ACE_LOCK> m (this->lock_); this->value_ = i; } #if defined (ACE_HAS_THREADS) diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp index cf407e90625..250ab4b0ee7 100644 --- a/ace/Timer_Queue_T.cpp +++ b/ace/Timer_Queue_T.cpp @@ -32,13 +32,13 @@ ACE_Timer_Node_T<TYPE>::ACE_Timer_Node_T (void) ACE_TRACE ("ACE_Timer_Node_T::ACE_Timer_Node_T"); } -template <class TYPE, class FUNCTOR, class LOCK> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, LOCK>::ACE_Timer_Queue_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK> +ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_Iterator_T (void) { } -template <class TYPE, class FUNCTOR, class LOCK> -ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, LOCK>::~ACE_Timer_Queue_Iterator_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK> +ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Queue_Iterator_T (void) { } @@ -50,11 +50,11 @@ ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, LOCK>::~ACE_Timer_Queue_Iterator_T (vo // Time_Value type stored in the Timer_Queue type itself. If some // external lock isn't held we'll have reentrancy problems! -template <class TYPE, class FUNCTOR, class LOCK> ACE_Time_Value * -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time) +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Time_Value * +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, max_wait_time)); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, max_wait_time)); if (this->is_empty ()) // Nothing on the Timer_Queue, so use whatever the caller gave us. @@ -87,8 +87,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::calculate_timeout (ACE_Time_Value *max_w } } -template <class TYPE, class FUNCTOR, class LOCK> ACE_Time_Value * -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time, +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Time_Value * +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::calculate_timeout (ACE_Time_Value *max_wait_time, ACE_Time_Value *the_timeout) { ACE_TRACE ("ACE_Timer_Queue_T::calculate_timeout"); @@ -130,8 +130,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::calculate_timeout (ACE_Time_Value *max_w return the_timeout; } -template <class TYPE, class FUNCTOR, class LOCK> void -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::dump (void) const +template <class TYPE, class FUNCTOR, class ACE_LOCK> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const { ACE_TRACE ("ACE_Timer_Queue_T::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); @@ -140,8 +140,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class TYPE, class FUNCTOR, class LOCK> -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, +template <class TYPE, class FUNCTOR, class ACE_LOCK> +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_T (FUNCTOR *upcall_functor, ACE_Free_List<ACE_Timer_Node_T <TYPE> > *freelist) : free_list_ (freelist == 0 ? new ACE_Locked_Free_List<ACE_Timer_Node_T <TYPE>, ACE_Null_Mutex> : freelist), gettimeofday_ (ACE_OS::gettimeofday), @@ -153,8 +153,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::ACE_Timer_Queue_T (FUNCTOR *upcall_funct ACE_TRACE ("ACE_Timer_Queue_T::ACE_Timer_Queue_T"); } -template <class TYPE, class FUNCTOR, class LOCK> -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::~ACE_Timer_Queue_T (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK> +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Queue_T (void) { ACE_TRACE ("ACE_Timer_Queue_T::~ACE_Timer_Queue_T"); @@ -166,14 +166,14 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::~ACE_Timer_Queue_T (void) delete this->free_list_; } -template <class TYPE, class FUNCTOR, class LOCK> ACE_Timer_Node_T<TYPE> * -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::alloc_node (void) +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE> * +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::alloc_node (void) { return this->free_list_->remove (); } -template <class TYPE, class FUNCTOR, class LOCK> void -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::free_node (ACE_Timer_Node_T<TYPE> *node) +template <class TYPE, class FUNCTOR, class ACE_LOCK> void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::free_node (ACE_Timer_Node_T<TYPE> *node) { this->free_list_->add (node); } @@ -181,11 +181,11 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::free_node (ACE_Timer_Node_T<TYPE> *node) // Run the <handle_timeout> method for all Timers whose values are <= // <cur_time>. -template <class TYPE, class FUNCTOR, class LOCK> int -ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::expire (const ACE_Time_Value &cur_time) +template <class TYPE, class FUNCTOR, class ACE_LOCK> int +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_time) { ACE_TRACE ("ACE_Timer_Queue_T::expire"); - ACE_MT (ACE_GUARD_RETURN (LOCK, ace_mon, this->mutex_, -1)); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); int number_of_timers_expired = 0; @@ -235,10 +235,10 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK>::expire (const ACE_Time_Value &cur_time) return number_of_timers_expired; } -template <class LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>::timeout (ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>, - LOCK> &timer_queue, +template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::timeout (ACE_Timer_Queue_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> &timer_queue, ACE_Event_Handler *handler, const void *act, const ACE_Time_Value &cur_time) @@ -250,10 +250,10 @@ ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>::timeout (ACE_Timer_Queue_T<ACE_Ev return 0; } -template <class LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>::cancellation (ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>, - LOCK> &timer_queue, +template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancellation (ACE_Timer_Queue_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> &timer_queue, ACE_Event_Handler *handler) { ACE_UNUSED_ARG (timer_queue); @@ -264,10 +264,10 @@ ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>::cancellation (ACE_Timer_Queue_T<A return 0; } -template <class LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>::deletion (ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>, - LOCK> &timer_queue, +template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::deletion (ACE_Timer_Queue_T<ACE_Event_Handler *, + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> &timer_queue, ACE_Event_Handler *handler, const void *arg) { diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h index 795ae36a5bb..1206f512ab7 100644 --- a/ace/Timer_Queue_T.h +++ b/ace/Timer_Queue_T.h @@ -121,7 +121,7 @@ private: // Id of this timer (used to cancel timers before they expire). }; -template <class TYPE, class FUNCTOR, class LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Queue_Iterator_T // = TITLE // Generic interface for iterating over a subclass of @@ -154,7 +154,7 @@ public: // Returns the node at the current position in the sequence }; -template <class TYPE, class FUNCTOR, class LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Queue_T // = TITLE // Provides an interface to timers. @@ -166,7 +166,7 @@ class ACE_Timer_Queue_T { public: - typedef ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, LOCK> ITERATOR; + typedef ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> ITERATOR; // Type of Iterator // = Initialization and termination methods. @@ -255,7 +255,7 @@ public: void timer_skew (const ACE_Time_Value &skew); const ACE_Time_Value &timer_skew (void) const; - LOCK &mutex (void); + ACE_LOCK &mutex (void); // Synchronization variable used by the queue FUNCTOR &upcall_functor (void); @@ -286,7 +286,7 @@ protected: virtual void free_node (ACE_Timer_Node_T<TYPE> *); // Factory method that frees a previously allocated node. - LOCK mutex_; + ACE_LOCK mutex_; // Synchronization variable for <ACE_Timer_Queue>. ACE_Free_List<ACE_Timer_Node_T<TYPE> > *free_list_; @@ -313,11 +313,11 @@ private: // Adjusts for timer skew in various clocks. // = Don't allow these operations for now. - ACE_Timer_Queue_T (const ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK> &); - void operator= (const ACE_Timer_Queue_T<TYPE, FUNCTOR, LOCK> &); + ACE_Timer_Queue_T (const ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> &); + void operator= (const ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> &); }; -template <class LOCK> +template <class ACE_LOCK> class ACE_Event_Handler_Handle_Timeout_Upcall // = TITLE // Functor for Timer_Queues. @@ -328,8 +328,8 @@ class ACE_Event_Handler_Handle_Timeout_Upcall { public: typedef ACE_Timer_Queue_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<LOCK>, - LOCK> + ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, + ACE_LOCK> TIMER_QUEUE; int timeout (TIMER_QUEUE &timer_queue, diff --git a/apps/JAWS/server/HTTP_Server_T.cpp b/apps/JAWS/server/HTTP_Server_T.cpp index e1fa6192168..ee219d24863 100644 --- a/apps/JAWS/server/HTTP_Server_T.cpp +++ b/apps/JAWS/server/HTTP_Server_T.cpp @@ -3,13 +3,13 @@ #if !defined (HTTP_SERVER_T_I) #define HTTP_SERVER_T_I -template <class LOCK> int -LOCK_SOCK_Acceptor<LOCK>::accept (ACE_SOCK_Stream &ns, - ACE_Addr *ra, - ACE_Time_Value *to, - int r) const +template <class ACE_LOCK> int +LOCK_SOCK_Acceptor<ACE_LOCK>::accept (ACE_SOCK_Stream &ns, + ACE_Addr *ra, + ACE_Time_Value *to, + int r) const { - ACE_Guard<LOCK> m ((LOCK &) this->lock_); + ACE_Guard<ACE_LOCK> m ((ACE_LOCK &) this->lock_); return ACE_SOCK_Acceptor::accept (ns, ra, to, r); } |