diff options
41 files changed, 268 insertions, 296 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index bdac6d8253c..17a7c6eef0b 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,3 +1,49 @@ +Sun Apr 27 17:44:28 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> + + * ace/Synch_T.h: Added a new macro ACE_SYNCH_RW_MUTEX to + complement the existing ACE_SYNCH_MUTEX and ACE_SYNCH_CONDITION + macros. This will clean up lots of code in various test + programs. + + * ace/Synch_T.h: Added two new macros, ACE_SYNCH_MUTEX and + ACE_SYNCH_CONDITION. These default to ACE_MT_SYNCH::MUTEX and + ACE_MT_SYNCH::MUTEX if template typedefs are supported and + ACE_HAS_THREADS is enabled. If template typedefs *aren't* + supported but ACE_HAS_THREADS is enabled these macros turn into + ACE_Thread_Mutex and ACE_Thread_Condition. Finally, if + ACE_HAS_THREADS is disabled these macros turn into + ACE_Null_Mutex and ACE_Null_Condition. These macros make it + possible to write code that is more portable across platforms + and configurations. Thanks to Carlos O'Ryan for this + suggestion. + + * ace/OS.h: Replaced all uses of ACE_SYNCH_MUTEX and + ACE_SYNCH_CONDITION with ACE_SYNCH_MUTEX_T and + ACE_SYNCH_CONDITION_T since (1) this usage relates to templates + and (2) it frees up the namespace for the new ACE_SYNCH_MUTEX + and ACE_SYNCH_CONDITION macros. + + * ace/Timer_Queue.cpp: Added yet more template specializations for + the benefit of GCC (ugh). + + * ace/Timer_Wheel_T.cpp: Had to revise things just a bit to + compile with GCC and it's lame template mechanism. This + required changing NODE * to ACE_Timer_Node_T<TYPE, FUNCTOR> * in + several method definitions. + + * apps/JAWS/server/HTTP_Server.h: Changed the use of ACE_WIN32 to + ACE_HAS_THREAD_SAFE_ACCEPT since this is a more precise way to + determine if the platform allows multiple threads to call + accept() on the same port. If other platforms support this + feature please make sure to add it to their config*.h files. + + * ace/config-win32-common.h: Defined ACE_HAS_THREAD_SAFE_ACCEPT, + since Win32 allows multiple threads to call accept() on the same + port. + + * examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp: The mutex + should be ACE_RW_Mutex, not ACE_Null_Mutex... + Sun Apr 27 18:13:24 1997 Irfan Pyarali <irfan@flamenco.cs.wustl.edu> * ace/Proactor.h: Added Timer_Wheel support. @@ -10,16 +56,6 @@ Sun Apr 27 18:13:24 1997 Sumedh Mungee <sumedh@cs.wustl.edu> * apps/JAWS/stress-testing: Removed unused argument warnings etc. -Sun Apr 27 14:18:45 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> - - * ace/Timer_Queue.cpp: Added yet more template specializations for - the benefit of GCC (ugh). - - * ace/Timer_Wheel_T.cpp: Had to revise things just a bit to - compile with GCC and it's lame template mechanism. This - required changing NODE * to ACE_Timer_Node_T<TYPE, FUNCTOR> * in - several method definitions. - Sun Apr 27 07:41:44 1997 David L. Levine <levine@cs.wustl.edu> * ace/Timer_Queue.cpp: added #includes for template specializations, diff --git a/ace/Message_Queue.cpp b/ace/Message_Queue.cpp index 83d93b1f4e4..3ac29a47e3f 100644 --- a/ace/Message_Queue.cpp +++ b/ace/Message_Queue.cpp @@ -116,7 +116,7 @@ template <ACE_SYNCH_1> int ACE_Message_Queue<ACE_SYNCH_2>::close (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::close"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); int res = this->deactivate_i (); @@ -342,7 +342,7 @@ ACE_Message_Queue<ACE_SYNCH_2>::peek_dequeue_head (ACE_Message_Block *&first_ite ACE_Time_Value *tv) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::peek_dequeue_head"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->deactivated_) { @@ -379,7 +379,7 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::enqueue_head"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); int queue_count; { @@ -430,7 +430,7 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_prio (ACE_Message_Block *new_item, int queue_count; { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->deactivated_) { @@ -485,7 +485,7 @@ ACE_Message_Queue<ACE_SYNCH_2>::enqueue_tail (ACE_Message_Block *new_item, int queue_count; { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->deactivated_) { @@ -529,7 +529,7 @@ ACE_Message_Queue<ACE_SYNCH_2>::dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::dequeue_head"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->deactivated_) { diff --git a/ace/Message_Queue.h b/ace/Message_Queue.h index 981ec4f1192..09e799b5cb1 100644 --- a/ace/Message_Queue.h +++ b/ace/Message_Queue.h @@ -233,13 +233,13 @@ protected: // The notification strategy used when a new message is enqueued. // = Synchronization primitives for controlling concurrent access. - ACE_SYNCH_MUTEX lock_; + ACE_SYNCH_MUTEX_T lock_; // Protect queue from concurrent access. - ACE_SYNCH_CONDITION notempty_cond_; + ACE_SYNCH_CONDITION_T notempty_cond_; // Used to make threads sleep until the queue is no longer empty. - ACE_SYNCH_CONDITION notfull_cond_; + ACE_SYNCH_CONDITION_T notfull_cond_; // Used to make threads sleep until the queue is no longer full. }; diff --git a/ace/Message_Queue.i b/ace/Message_Queue.i index 73bdb402b8f..15e07b64da0 100644 --- a/ace/Message_Queue.i +++ b/ace/Message_Queue.i @@ -43,7 +43,7 @@ template <ACE_SYNCH_1> ACE_INLINE int ACE_Message_Queue<ACE_SYNCH_2>::is_empty (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::is_empty"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->is_empty_i (); } @@ -54,7 +54,7 @@ template <ACE_SYNCH_1> ACE_INLINE int ACE_Message_Queue<ACE_SYNCH_2>::is_full (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::is_full"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->is_full_i (); } @@ -63,7 +63,7 @@ template <ACE_SYNCH_1> ACE_INLINE size_t ACE_Message_Queue<ACE_SYNCH_2>::high_water_mark (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::high_water_mark"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->high_water_mark_; } @@ -72,7 +72,7 @@ template <ACE_SYNCH_1> ACE_INLINE void ACE_Message_Queue<ACE_SYNCH_2>::high_water_mark (size_t hwm) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::high_water_mark"); - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); + ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_); this->high_water_mark_ = hwm; } @@ -81,7 +81,7 @@ template <ACE_SYNCH_1> ACE_INLINE size_t ACE_Message_Queue<ACE_SYNCH_2>::low_water_mark (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::low_water_mark"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->low_water_mark_; } @@ -90,7 +90,7 @@ template <ACE_SYNCH_1> ACE_INLINE void ACE_Message_Queue<ACE_SYNCH_2>::low_water_mark (size_t lwm) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::low_water_mark"); - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); + ACE_GUARD (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_); this->low_water_mark_ = lwm; } @@ -101,7 +101,7 @@ template <ACE_SYNCH_1> ACE_INLINE size_t ACE_Message_Queue<ACE_SYNCH_2>::message_bytes (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::message_bytes"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->cur_bytes_; } @@ -112,7 +112,7 @@ template <ACE_SYNCH_1> ACE_INLINE size_t ACE_Message_Queue<ACE_SYNCH_2>::message_count (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::message_count"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, 0); return this->cur_count_; } @@ -121,7 +121,7 @@ template <ACE_SYNCH_1> int ACE_Message_Queue<ACE_SYNCH_2>::activate (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::activate"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->activate_i (); } @@ -130,7 +130,7 @@ template <ACE_SYNCH_1> int ACE_Message_Queue<ACE_SYNCH_2>::deactivate (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_2>::deactivate"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->deactivate_i (); } @@ -145,7 +145,7 @@ ACE_Message_Queue_Iterator<ACE_SYNCH_2>::ACE_Message_Queue_Iterator (ACE_Message template <ACE_SYNCH_1> int ACE_Message_Queue_Iterator<ACE_SYNCH_2>::next (ACE_Message_Block *&entry) { - ACE_Read_Guard<ACE_SYNCH_MUTEX> m (this->queue_.lock_); + ACE_Read_Guard<ACE_SYNCH_MUTEX_T> m (this->queue_.lock_); if (this->curr_ != 0) { @@ -159,7 +159,7 @@ ACE_Message_Queue_Iterator<ACE_SYNCH_2>::next (ACE_Message_Block *&entry) template <ACE_SYNCH_1> int ACE_Message_Queue_Iterator<ACE_SYNCH_2>::advance (void) { - ACE_Read_Guard<ACE_SYNCH_MUTEX> m (this->queue_.lock_); + ACE_Read_Guard<ACE_SYNCH_MUTEX_T> m (this->queue_.lock_); this->curr_ = this->curr_->next (); return this->curr_ != 0; @@ -183,7 +183,7 @@ ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_2>::ACE_Message_Queue_Reverse_Itera template <ACE_SYNCH_1> int ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_2>::next (ACE_Message_Block *&entry) { - ACE_Read_Guard<ACE_SYNCH_MUTEX> m (this->queue_.lock_); + ACE_Read_Guard<ACE_SYNCH_MUTEX_T> m (this->queue_.lock_); if (this->curr_ != 0) { @@ -197,7 +197,7 @@ ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_2>::next (ACE_Message_Block *&entry template <ACE_SYNCH_1> int ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH_2>::advance (void) { - ACE_Read_Guard<ACE_SYNCH_MUTEX> m (this->queue_.lock_); + ACE_Read_Guard<ACE_SYNCH_MUTEX_T> m (this->queue_.lock_); this->curr_ = this->curr_->prev (); return this->curr_ != 0; @@ -562,8 +562,8 @@ private: // Handle ACE_Message_Queue. #define ACE_SYNCH_1 class _ACE_SYNCH #define ACE_SYNCH_2 _ACE_SYNCH -#define ACE_SYNCH_MUTEX ACE_TYPENAME _ACE_SYNCH::MUTEX -#define ACE_SYNCH_CONDITION ACE_TYPENAME _ACE_SYNCH::CONDITION +#define ACE_SYNCH_MUTEX_T ACE_TYPENAME _ACE_SYNCH::MUTEX +#define ACE_SYNCH_CONDITION_T ACE_TYPENAME _ACE_SYNCH::CONDITION // Handle ACE_Malloc* #define ACE_MEM_POOL_1 class _ACE_MEM_POOL @@ -647,10 +647,10 @@ private: #else /* TEMPLATES are broken in some form or another (i.e., most C++ compilers) */ // Handle ACE_Message_Queue. -#define ACE_SYNCH_1 class _ACE_SYNCH_MUTEX, class _ACE_SYNCH_CONDITION -#define ACE_SYNCH_2 _ACE_SYNCH_MUTEX, _ACE_SYNCH_CONDITION -#define ACE_SYNCH_MUTEX _ACE_SYNCH_MUTEX -#define ACE_SYNCH_CONDITION _ACE_SYNCH_CONDITION +#define ACE_SYNCH_1 class _ACE_SYNCH_MUTEX_T, class _ACE_SYNCH_CONDITION_T +#define ACE_SYNCH_2 _ACE_SYNCH_MUTEX_T, _ACE_SYNCH_CONDITION_T +#define ACE_SYNCH_MUTEX_T _ACE_SYNCH_MUTEX_T +#define ACE_SYNCH_CONDITION_T _ACE_SYNCH_CONDITION_T // Handle ACE_Malloc* #define ACE_MEM_POOL_1 class _ACE_MEM_POOL, class _ACE_MEM_POOL_OPTIONS diff --git a/ace/README b/ace/README index 80e74975093..4be656248a3 100644 --- a/ace/README +++ b/ace/README @@ -134,6 +134,7 @@ ACE_HAS_TEMPLATE_SPECIALIZATION Compiler implements template specialization ACE_HAS_TEMPLATE_TYPEDEFS Compiler implements templates that support typedefs inside of classes used as formal arguments to a template class. ACE_HAS_TERM_IOCTLS Platform has terminal ioctl flags like TCGETS and TCSETS. ACE_HAS_THREADS Platform supports threads +ACE_HAS_THREAD_SAFE_ACCEPT Platform allows multiple threads to call accept() on the same port (e.g., WinNT). ACE_HAS_THREAD_SELF Platform has thread_self() rather than pthread_self() (e.g., DCETHREADS and AIX) ACE_HAS_THREAD_SPECIFIC_STORAGE Compiler/platform has thread-specific storage ACE_HAS_THR_C_DEST The pthread_keycreate() routine *must* take extern C functions. diff --git a/ace/Stream.cpp b/ace/Stream.cpp index 19508414540..a7e77ea3698 100644 --- a/ace/Stream.cpp +++ b/ace/Stream.cpp @@ -254,7 +254,7 @@ ACE_Stream<ACE_SYNCH_2>::open (void *a, ACE_Module<ACE_SYNCH_2> *tail) { ACE_TRACE ("ACE_Stream<ACE_SYNCH_2>::open"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); ACE_Task<ACE_SYNCH_2> *h1 = 0, *h2 = 0; ACE_Task<ACE_SYNCH_2> *t1 = 0, *t2 = 0; @@ -310,7 +310,7 @@ template <ACE_SYNCH_1> int ACE_Stream<ACE_SYNCH_2>::close (int flags) { ACE_TRACE ("ACE_Stream<ACE_SYNCH_2>::close"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); if (this->stream_head_ != 0 && this->stream_tail_ != 0) @@ -436,7 +436,7 @@ ACE_Stream<ACE_SYNCH_2>::link (ACE_Stream<ACE_SYNCH_2> &us) { ACE_TRACE ("ACE_Stream<ACE_SYNCH_2>::link"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->link_i (us); } @@ -492,7 +492,7 @@ template <ACE_SYNCH_1> int ACE_Stream<ACE_SYNCH_2>::unlink (void) { ACE_TRACE ("ACE_Stream<ACE_SYNCH_2>::unlink"); - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); return this->unlink_i (); } diff --git a/ace/Stream.h b/ace/Stream.h index 25e756c4ddf..b4b7d648f13 100644 --- a/ace/Stream.h +++ b/ace/Stream.h @@ -150,10 +150,10 @@ private: // Pointer to an adjoining linked stream. // = Synchronization objects used for thread-safe streams. - ACE_SYNCH_MUTEX lock_; + ACE_SYNCH_MUTEX_T lock_; // Protect the stream against race conditions. - ACE_SYNCH_CONDITION final_close_; + ACE_SYNCH_CONDITION_T final_close_; // Use to tell all threads waiting on the close that we are done. }; diff --git a/ace/Synch.h b/ace/Synch.h index e45d0e75685..db59af18ea1 100644 --- a/ace/Synch.h +++ b/ace/Synch.h @@ -39,7 +39,7 @@ class ACE_Lock // This class is typically used in conjunction with the // <ACE_Lock_Adapter> in order to provide a polymorphic // interface to the ACE synchronization mechanisms (e.g., - // <ACE_Mutex>, <ACE_Semaphore>, <ACE_RW_Lock>, etc). Note that + // <ACE_Mutex>, <ACE_Semaphore>, <ACE_RW_Mutex>, etc). Note that // the reason that all of ACE doesn't use polymorphic locks is // that (1) they add ~20% extra overhead for virtual function // calls and (2) objects with virtual functions can't be placed @@ -750,7 +750,8 @@ public: // Declare the dynamic allocation hooks }; -#if defined (ACE_HAS_THREADS) /* ACE platform supports some form of threading. */ +// ACE platform supports some form of threading. +#if defined (ACE_HAS_THREADS) class ACE_Export ACE_Thread_Mutex // = TITLE diff --git a/ace/Synch_T.h b/ace/Synch_T.h index c67892e6119..82bde833a89 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -31,7 +31,7 @@ class ACE_Lock_Adapter : public ACE_Lock // combine the <ACE_Lock> abstract base class (which contains // pure virtual methods) with any of the other concrete ACE // synchronization classes (e.g., <ACE_Mutex>, <ACE_Semaphore>, - // <ACE_RW_Lock>, etc.). + // <ACE_RW_Mutex>, etc.). // // = DESCRIPTION // This class uses a form of the Adapter pattern. @@ -272,10 +272,13 @@ class ACE_NULL_SYNCH { public: typedef ACE_Null_Mutex MUTEX; - // "Do-nothing" mutex type. + // "Do-nothing" Mutex type. + + typedef ACE_Null_Mutex RW_MUTEX; + // "Do-nothing" RW Mutex type. typedef ACE_Null_Condition_Mutex CONDITION; - // "Do-nothing" condition type. + // "Do-nothing" Condition type. }; #else /* Necessary to support broken cfront-based C++ compilers... */ #define ACE_NULL_SYNCH ACE_Null_Mutex, ACE_Null_Condition_Mutex @@ -608,6 +611,7 @@ private: void operator= (const ACE_Condition<MUTEX> &); ACE_Condition (const ACE_Condition<MUTEX> &c): mutex_ (c.mutex_) {} }; + template <class MUTEX> class ACE_Thread_Condition : public ACE_Condition<MUTEX> // = TITLE @@ -634,15 +638,25 @@ class ACE_MT_SYNCH { public: typedef ACE_Thread_Mutex MUTEX; + typedef ACE_RW_Thread_Mutex RW_MUTEX; typedef ACE_Condition_Thread_Mutex CONDITION; }; +#define ACE_SYNCH_MUTEX ACE_MT_SYNCH::MUTEX +#define ACE_SYNCH_RW_MUTEX ACE_MT_SYNCH::RW_MUTEX +#define ACE_SYNCH_CONDITION ACE_MT_SYNCH::CONDITION #else /* Necessary to support broken cfront-based C++ compilers... */ -#define ACE_MT_SYNCH ACE_Thread_Mutex,ACE_Condition_Thread_Mutex +#define ACE_MT_SYNCH ACE_Thread_Mutex, ACE_Condition_Thread_Mutex +#define ACE_SYNCH_MUTEX ACE_Thread_Mutex +#define ACE_SYNCH_RW_MUTEX ACE_RW_Thread_Mutex +#define ACE_SYNCH_CONDITION ACE_Thread_Condition #endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ #define ACE_SYNCH ACE_MT_SYNCH #else #define ACE_SYNCH ACE_NULL_SYNCH +#define ACE_SYNCH_MUTEX ACE_Null_Mutex +#define ACE_SYNCH_RW_MUTEX ACE_Null_Mutex +#define ACE_SYNCH_CONDITION ACE_Null_Condition #endif /* ACE_HAS_THREADS */ #if defined (__ACE_INLINE__) diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 4c08e82dcba..a3978526626 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -12,6 +12,7 @@ // Platform supports pread() and pwrite() #define ACE_HAS_P_READ_WRITE +#define ACE_HAS_THREAD_SAFE_ACCEPT #define ACE_HAS_EXCEPTIONS #define ACE_LACKS_SIGACTION #define ACE_LACKS_SIGSET diff --git a/apps/Gateway/Gateway/Event_Channel.cpp b/apps/Gateway/Gateway/Event_Channel.cpp index ae07185d91c..43c0e919e40 100644 --- a/apps/Gateway/Gateway/Event_Channel.cpp +++ b/apps/Gateway/Gateway/Event_Channel.cpp @@ -428,24 +428,21 @@ ACE_Event_Channel::open (void *) // If we're not running reactively, then we need to make sure that // <ACE_Message_Block> reference counting operations are // thread-safe. Therefore, we create an <ACE_Lock_Adapter> that is - // parameterized by <REF_COUNT_MUTEX> to prevent race conditions. + // parameterized by <ACE_SYNCH_MUTEX> to prevent race conditions. if (this->options ().threading_strategy_ != ACE_Event_Channel_Options::REACTIVE) ACE_NEW_RETURN (this->options ().locking_strategy_, - ACE_Lock_Adapter<REF_COUNT_MUTEX>, + ACE_Lock_Adapter<ACE_SYNCH_MUTEX>, -1); return 0; } #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Lock_Adapter<REF_COUNT_MUTEX>; +template class ACE_Lock_Adapter<ACE_SYNCH_MUTEX>; template class ACE_Map_Iterator<ACE_INT32, Proxy_Handler *, MAP_MUTEX>; template class ACE_Map_Manager<ACE_INT32, Proxy_Handler *, MAP_MUTEX>; template class ACE_Message_Queue<ACE_NULL_SYNCH>; -#if defined (ACE_HAS_THREADS) template class ACE_Task<ACE_SYNCH>; -#endif /* ACE_HAS_THREADS */ template class ACE_Module<ACE_NULL_SYNCH>; -template class ACE_Task<ACE_NULL_SYNCH>; template class ACE_Thru_Task<ACE_NULL_SYNCH>; template class ACE_Unbounded_Set_Iterator<Proxy_Handler *>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/apps/Gateway/Gateway/Event_Channel.h b/apps/Gateway/Gateway/Event_Channel.h index 9ef23732328..bdce1e13463 100644 --- a/apps/Gateway/Gateway/Event_Channel.h +++ b/apps/Gateway/Gateway/Event_Channel.h @@ -22,12 +22,6 @@ #include "Consumer_Dispatch_Set.h" #include "Event_Forwarding_Discriminator.h" -#if defined (ACE_HAS_THREADS) -typedef ACE_Thread_Mutex REF_COUNT_MUTEX; -#else -typedef ACE_Null_Mutex REF_COUNT_MUTEX; -#endif /* ACE_HAS_THREADS */ - typedef ACE_Null_Mutex MAP_MUTEX; class ACE_Svc_Export ACE_Event_Channel_Options @@ -41,7 +35,7 @@ public: ~ACE_Event_Channel_Options (void); // Termination. - ACE_Lock_Adapter<REF_COUNT_MUTEX> *locking_strategy_; + ACE_Lock_Adapter<ACE_SYNCH_MUTEX> *locking_strategy_; // Points to the locking strategy used for serializing access to the // reference count in <ACE_Message_Block>. If it's 0, then there's // no locking strategy and we're using a REACTIVE concurrency diff --git a/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp b/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp index dbc7b5c7b71..abe3bdbe55a 100644 --- a/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp +++ b/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp @@ -92,19 +92,13 @@ Proxy_Handler_Connector::initiate_connection (Proxy_Handler *proxy_handler, return 0; } -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<Proxy_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Tuple<Proxy_Handler>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Proxy_Handler> *, RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Proxy_Handler> *, RW_MUTEX>; +template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Proxy_Handler> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Proxy_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Proxy_Handler> *>; -template class ACE_Guard<RW_MUTEX>; -template class ACE_Read_Guard<RW_MUTEX>; -template class ACE_Write_Guard<RW_MUTEX>; +template class ACE_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Read_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/apps/JAWS/server/HTTP_Handler.cpp b/apps/JAWS/server/HTTP_Handler.cpp index 2f0c2af9c55..d80c744db92 100644 --- a/apps/JAWS/server/HTTP_Handler.cpp +++ b/apps/JAWS/server/HTTP_Handler.cpp @@ -33,7 +33,7 @@ void HTTP_Handler::open (ACE_HANDLE handle, ACE_Message_Block &initial_data) { - ACE_DEBUG ((LM_DEBUG, "(%t) New connection \n")); + ACE_DEBUG ((LM_DEBUG, " (%t) New connection \n")); this->handle_ = handle; this->io_.handle (this->handle_); @@ -126,8 +126,8 @@ HTTP_Handler::serve_error (int status_code) char buffer[2 * MAXPATHLEN]; int length = sprintf (buffer, errormessage, - status_code, HTTP_Status_Code::instance()[status_code], - status_code, HTTP_Status_Code::instance()[status_code], + status_code, HTTP_Status_Code::instance ()[status_code], + status_code, HTTP_Status_Code::instance ()[status_code], request_.filename ()); this->io_.send_error_message (buffer, length); @@ -137,13 +137,13 @@ void HTTP_Handler::serve_directory (void) { // We'll just forbid it for now. - this->serve_error(HTTP_Status_Code::STATUS_FORBIDDEN); + this->serve_error (HTTP_Status_Code::STATUS_FORBIDDEN); } void HTTP_Handler::receive_file_complete (void) { - ACE_DEBUG ((LM_DEBUG, "(%t) %s received successfully\n", request_.filename ())); + ACE_DEBUG ((LM_DEBUG, " (%t) %s received successfully\n", request_.filename ())); char buffer[BUFSIZ]; ACE_OS::sprintf (buffer, "%s %d %s", @@ -156,7 +156,7 @@ HTTP_Handler::receive_file_complete (void) void HTTP_Handler::receive_file_error (int result) { - ACE_DEBUG ((LM_DEBUG, "(%t) %s error in receiving file\n", request_.filename ())); + ACE_DEBUG ((LM_DEBUG, " (%t) %s error in receiving file\n", request_.filename ())); char buffer[BUFSIZ]; ACE_OS::sprintf (buffer, "%s %d %s", @@ -181,49 +181,49 @@ HTTP_Handler::error_message_complete (void) void HTTP_Handler::transmit_file_complete (void) { - ACE_DEBUG ((LM_DEBUG, "(%t) %s transmitted successfully\n", request_.filename ())); + ACE_DEBUG ((LM_DEBUG, " (%t) %s transmitted successfully\n", request_.filename ())); this->done (); } void HTTP_Handler::transmit_file_error (int result) { - ACE_DEBUG ((LM_DEBUG, "(%t) %s error in transmitting file\n", request_.filename ())); + ACE_DEBUG ((LM_DEBUG, " (%t) %s error in transmitting file\n", request_.filename ())); this->serve_error (result); } void HTTP_Handler::read_error (void) { - ACE_DEBUG ((LM_DEBUG, "(%t) error in reading request\n")); + ACE_DEBUG ((LM_DEBUG, " (%t) error in reading request\n")); this->done (); } void HTTP_Handler::write_error (void) { - ACE_DEBUG ((LM_DEBUG, "(%t) %s error in writing response\n", request_.filename ())); + ACE_DEBUG ((LM_DEBUG, " (%t) %s error in writing response\n", request_.filename ())); this->done (); } void HTTP_Handler::timeout (void) { - ACE_DEBUG ((LM_DEBUG, "(%t) %s error in reading request\n", request_.filename ())); + ACE_DEBUG ((LM_DEBUG, " (%t) %s error in reading request\n", request_.filename ())); this->serve_error (HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR); } void HTTP_Handler::request_too_long (void) { - ACE_DEBUG ((LM_DEBUG, "(%t) request too long\n")); + ACE_DEBUG ((LM_DEBUG, " (%t) request too long\n")); this->serve_error (HTTP_Status_Code::STATUS_BAD_REQUEST); } void HTTP_Handler::invalid_request (int error) { - ACE_DEBUG ((LM_DEBUG, "(%t) invalid request\n")); + ACE_DEBUG ((LM_DEBUG, " (%t) invalid request\n")); this->serve_error (error); } diff --git a/apps/JAWS/server/HTTP_Request.cpp b/apps/JAWS/server/HTTP_Request.cpp index c03ab84d1f8..91f1c3db96b 100644 --- a/apps/JAWS/server/HTTP_Request.cpp +++ b/apps/JAWS/server/HTTP_Request.cpp @@ -64,7 +64,7 @@ HTTP_fix_path (char *path) percentcode[0] = path[++i]; percentcode[1] = path[++i]; percentcode[2] = '\0'; - path[j] = ACE_OS::strtol(percentcode, (char **)0, 16); + path[j] = ACE_OS::strtol (percentcode, (char **)0, 16); } else path[j] = path[i]; } @@ -191,12 +191,12 @@ HTTP_Request::dump (void) " data string is %s," " datalen is %d," " status is %d, which is %s\n\n", - this->filename() ? this->filename() : "EMPTY", - this->content_length(), - this->data() ? this->data() : "EMPTY", - this->data_length(), - this->status(), - this->status_string())); + this->filename () ? this->filename () : "EMPTY", + this->content_length (), + this->data () ? this->data () : "EMPTY", + this->data_length (), + this->status (), + this->status_string ())); break; case PUT : @@ -206,12 +206,12 @@ HTTP_Request::dump (void) " data string is %s," " datalen is %d," " status is %d, which is %s\n\n", - this->filename() ? this->filename() : "EMPTY", - this->content_length(), - this->data() ? this->data() : "EMPTY", - this->data_length(), - this->status(), - this->status_string())); + this->filename () ? this->filename () : "EMPTY", + this->content_length (), + this->data () ? this->data () : "EMPTY", + this->data_length (), + this->status (), + this->status_string ())); break; case NO_TYPE : diff --git a/apps/JAWS/server/HTTP_Server.cpp b/apps/JAWS/server/HTTP_Server.cpp index 58d343140a6..afc51fde2d1 100644 --- a/apps/JAWS/server/HTTP_Server.cpp +++ b/apps/JAWS/server/HTTP_Server.cpp @@ -17,21 +17,21 @@ HTTP_Server::parse_args (int argc, char *argv[]) this->port_ = 0; this->threads_ = 0; - ACE_Get_Opt get_opt(argc, argv, "p:n:s:"); - while ((c = get_opt()) != -1) + ACE_Get_Opt get_opt (argc, argv, "p:n:s:"); + while ((c = get_opt ()) != -1) switch (c) { case 'p': - this->port_ = ACE_OS::atoi(get_opt.optarg); + this->port_ = ACE_OS::atoi (get_opt.optarg); break; case 'n': - this->threads_ = ACE_OS::atoi(get_opt.optarg); + this->threads_ = ACE_OS::atoi (get_opt.optarg); break; case 's': // 0 -> synch thread pool // 1 -> thread per request // 2 -> asynch thread pool - this->strategy_ = ACE_OS::atoi(get_opt.optarg); + this->strategy_ = ACE_OS::atoi (get_opt.optarg); break; default: break; @@ -74,7 +74,7 @@ HTTP_Server::init (int argc, char *argv[]) int HTTP_Server::fini (void) { - this->tm_.close(); + this->tm_.close (); return 0; } @@ -91,12 +91,12 @@ HTTP_Server::synch_thread_pool (void) if (t->open () != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Thread_Pool_Task::open"), -1); } - this->tm_.wait(); + this->tm_.wait (); return 0; } Synch_Thread_Pool_Task::Synch_Thread_Pool_Task (HTTP_Acceptor &acceptor, ACE_Thread_Manager &tm) - : ACE_Task<ACE_NULL_SYNCH>(&tm), acceptor_(acceptor) + : ACE_Task<ACE_NULL_SYNCH> (&tm), acceptor_ (acceptor) { } @@ -125,7 +125,7 @@ Synch_Thread_Pool_Task::svc (void) HTTP_Handler *handler = factory.create_http_handler (); handler->open (stream.get_handle (), *mb); mb->release (); - ACE_DEBUG ((LM_DEBUG, "(%t) in Synch_Thread_Pool_Task::svc, recycling\n")); + ACE_DEBUG ((LM_DEBUG, " (%t) in Synch_Thread_Pool_Task::svc, recycling\n")); } return 0; @@ -153,7 +153,7 @@ HTTP_Server::thread_per_request (void) Thread_Per_Request_Task::Thread_Per_Request_Task (ACE_HANDLE handle, ACE_Thread_Manager &tm) - : ACE_Task<ACE_NULL_SYNCH>(&tm), + : ACE_Task<ACE_NULL_SYNCH> (&tm), handle_ (handle) { } @@ -184,7 +184,7 @@ Thread_Per_Request_Task::svc (void) int Thread_Per_Request_Task::close (u_long) { - ACE_DEBUG ((LM_DEBUG, "(%t) Thread_Per_Request_Task::svc, dying\n")); + ACE_DEBUG ((LM_DEBUG, " (%t) Thread_Per_Request_Task::svc, dying\n")); delete this; return 0; } @@ -203,11 +203,11 @@ HTTP_Server::asynch_thread_pool (void) for (int i = 0; i < this->threads_; i++) { Asynch_Thread_Pool_Task *t; - ACE_NEW_RETURN (t, Asynch_Thread_Pool_Task (*ACE_Service_Config::proactor(), this->tm_), -1); + ACE_NEW_RETURN (t, Asynch_Thread_Pool_Task (*ACE_Service_Config::proactor (), this->tm_), -1); if (t->open () != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Thread_Pool_Task::open"), -1); } - return this->tm_.wait(); + return this->tm_.wait (); #endif /* ACE_WIN32 */ return -1; } @@ -233,10 +233,9 @@ int Asynch_Thread_Pool_Task::svc (void) { for (;;) - { - if (this->proactor_.handle_events () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Proactor::handle_events"), -1); - } + if (this->proactor_.handle_events () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Proactor::handle_events"), -1); + return 0; } diff --git a/apps/JAWS/server/HTTP_Server.h b/apps/JAWS/server/HTTP_Server.h index 738e7e969fd..8a27257cd64 100644 --- a/apps/JAWS/server/HTTP_Server.h +++ b/apps/JAWS/server/HTTP_Server.h @@ -1,41 +1,36 @@ // -*- C++ -*- -// HTTP_Server.h #if !defined (HTTP_SERVER_H) #define HTTP_SERVER_H -class ACE_Proactor; - #include "ace/Service_Object.h" #include "ace/Thread_Manager.h" #include "ace/Acceptor.h" #include "ace/SOCK_Acceptor.h" #include "ace/Task.h" #include "ace/Asynch_IO.h" - #include "JAWS/server/HTTP_Handler.h" // Include the templates here. #include "JAWS/server/HTTP_Server_T.h" -#if defined (ACE_WIN32) +// Forward declaration. +class ACE_Proactor; + +#if defined (ACE_HAS_THREAD_SAFE_ACCEPT) typedef LOCK_SOCK_Acceptor<ACE_Null_Mutex> HTTP_SOCK_Acceptor; #else -typedef LOCK_SOCK_Acceptor<ACE_Thread_Mutex> HTTP_SOCK_Acceptor; -#endif /* ACE_WIN32 */ +typedef LOCK_SOCK_Acceptor<ACE_SYNCH_MUTEX> HTTP_SOCK_Acceptor; +#endif /* ACE_HAS_THREAD_SAFE_ACCEPT */ typedef HTTP_SOCK_Acceptor HTTP_Acceptor; class HTTP_Server : public ACE_Service_Object - // // = TITLE - // // This server is used to create HTTP Handlers for the Web // server // // = DESCRIPTION - // - // { public: virtual int init (int argc, char *argv[]); @@ -45,13 +40,13 @@ public: // Exit hooks protected: - virtual int thread_per_request (); + virtual int thread_per_request (void); // Thread Per Request implementation - virtual int asynch_thread_pool (); + virtual int asynch_thread_pool (void); // Asynch Thread Pool implementation - virtual int synch_thread_pool (); + virtual int synch_thread_pool (void); // Synch Thread Pool implementation void setup_signal_handler (void); @@ -66,14 +61,10 @@ private: }; class Synch_Thread_Pool_Task : public ACE_Task<ACE_NULL_SYNCH> - // // = TITLE - // // Used to implement Synch Thread Pool // // = DESCRIPTION - // - // { public: Synch_Thread_Pool_Task (HTTP_Acceptor &acceptor, ACE_Thread_Manager &tm); @@ -85,14 +76,10 @@ private: }; class Thread_Per_Request_Task : public ACE_Task<ACE_NULL_SYNCH> - // // = TITLE - // // Used to implement Thread Per Request // // = DESCRIPTION - // - // { public: Thread_Per_Request_Task (ACE_HANDLE handle, ACE_Thread_Manager &tm); @@ -107,14 +94,10 @@ private: // This only works on Win32 #if defined (ACE_WIN32) class Asynch_Thread_Pool_Task : public ACE_Task<ACE_NULL_SYNCH> - // // = TITLE - // // Used to implement Asynch Thread Pool // // = DESCRIPTION - // - // { public: Asynch_Thread_Pool_Task (ACE_Proactor &proactor, ACE_Thread_Manager &tm); diff --git a/apps/JAWS/server/HTTP_Server_T.cpp b/apps/JAWS/server/HTTP_Server_T.cpp index 195f7fe0f87..ab394ada48e 100644 --- a/apps/JAWS/server/HTTP_Server_T.cpp +++ b/apps/JAWS/server/HTTP_Server_T.cpp @@ -7,7 +7,7 @@ LOCK_SOCK_Acceptor<LOCK>::accept (ACE_SOCK_Stream &ns, ACE_Time_Value *to, int r) const { - ACE_Guard<LOCK> m ((LOCK &)this->lock_); + ACE_Guard<LOCK> m ((LOCK &) this->lock_); return ACE_SOCK_Acceptor::accept (ns, ra, to, r); } diff --git a/apps/JAWS/server/VFS.cpp b/apps/JAWS/server/VFS.cpp index 8bba2b08f13..da13c06ad6b 100644 --- a/apps/JAWS/server/VFS.cpp +++ b/apps/JAWS/server/VFS.cpp @@ -225,7 +225,7 @@ JAWS_VFS_Node::uritopath (void) #if !defined (ACE_WIN32) char pw_buf[BUFSIZ]; struct passwd pw_struct; - if (ACE_OS::getpwnam_r(buf, &pw_struct, pw_buf, sizeof (pw_buf)) == 0) + if (ACE_OS::getpwnam_r (buf, &pw_struct, pw_buf, sizeof (pw_buf)) == 0) return; ACE_OS::strcpy (buf, pw_struct.pw_dir); #endif /* ACE_WIN32 */ diff --git a/apps/JAWS/server/test_HTTP_Request.cpp b/apps/JAWS/server/test_HTTP_Request.cpp index 2aa85cdc3e9..1085fe9ceb9 100644 --- a/apps/JAWS/server/test_HTTP_Request.cpp +++ b/apps/JAWS/server/test_HTTP_Request.cpp @@ -15,7 +15,7 @@ static char* request_strings [] = static int total = 2; int -main() +main () { int index = 0; HTTP_Request request; diff --git a/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp b/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp index 017543878b2..078209ff6c7 100644 --- a/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp +++ b/examples/ASX/Event_Server/Event_Server/Peer_Router.cpp @@ -346,9 +346,8 @@ Peer_Router::control (ACE_Message_Block *mb) #endif /* _PEER_ROUTER_C */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR>; -template class ACE_Map_Iterator<ROUTING_KEY, Peer_Handler *, ROUTER_MUTEX>; -template class ACE_Map_Manager<ROUTING_KEY, Peer_Handler *, ROUTER_MUTEX>; +template class ACE_Map_Iterator<ROUTING_KEY, Peer_Handler *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<ROUTING_KEY, Peer_Handler *, ACE_SYNCH_RW_MUTEX>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/ASX/Event_Server/Event_Server/Peer_Router.h b/examples/ASX/Event_Server/Event_Server/Peer_Router.h index 7bdfe46a271..69eed7098f2 100644 --- a/examples/ASX/Event_Server/Event_Server/Peer_Router.h +++ b/examples/ASX/Event_Server/Event_Server/Peer_Router.h @@ -15,12 +15,6 @@ typedef ACE_HANDLE ROUTING_KEY; class Peer_Router; class Peer_Router_Context; -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex ROUTER_MUTEX; -#else -typedef ACE_Null_Mutex ROUTER_MUTEX; -#endif /* ACE_MT_SAFE */ - class Peer_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_SYNCH> // = TITLE // Receive input from a Peer and forward to the appropriate @@ -84,8 +78,8 @@ private: // Pointer to the <Peer_Router> that we are accepting for. // = Useful typedefs - typedef ACE_Map_Manager <ROUTING_KEY, Peer_Handler *, ROUTER_MUTEX> PEER_MAP; - typedef ACE_Map_Iterator<ROUTING_KEY, Peer_Handler *, ROUTER_MUTEX> PEER_ITERATOR; + typedef ACE_Map_Manager <ROUTING_KEY, Peer_Handler *, ACE_SYNCH_RW_MUTEX> PEER_MAP; + typedef ACE_Map_Iterator<ROUTING_KEY, Peer_Handler *, ACE_SYNCH_RW_MUTEX> PEER_ITERATOR; typedef ACE_Map_Entry<ROUTING_KEY, Peer_Handler *> PEER_ENTRY; PEER_MAP peer_map_; diff --git a/examples/ASX/Event_Server/Transceiver/transceiver.cpp b/examples/ASX/Event_Server/Transceiver/transceiver.cpp index d37335de9fd..7a1a9f7153d 100644 --- a/examples/ASX/Event_Server/Transceiver/transceiver.cpp +++ b/examples/ASX/Event_Server/Transceiver/transceiver.cpp @@ -205,15 +205,9 @@ main (int argc, char *argv[]) return 0; } -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<Event_Transceiver, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Tuple<Event_Transceiver>; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<Event_Transceiver> *, RW_MUTEX>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<Event_Transceiver> *, RW_MUTEX>; +template class ACE_Map_Iterator<int, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<int, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp b/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp index 07b773c614f..a1421e05ef3 100644 --- a/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp +++ b/examples/ASX/UPIPE_Event_Server/Consumer_Router.cpp @@ -126,19 +126,12 @@ Consumer_Router::info (char **strp, size_t length) const return ACE_OS::strlen (mod_name); } -#endif /* ACE_HAS_THREADS */ - -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Acceptor<Consumer_Handler, ACE_UPIPE_ACCEPTOR>; template class Acceptor_Factory<Consumer_Handler, CONSUMER_KEY>; template class Peer_Handler<CONSUMER_ROUTER, CONSUMER_KEY>; template class Peer_Router<Consumer_Handler, CONSUMER_KEY>; -template class ACE_Map_Iterator<long, Consumer_Handler *, RW_MUTEX>; -template class ACE_Map_Manager<long, Consumer_Handler *, RW_MUTEX>; +template class ACE_Map_Iterator<long, Consumer_Handler *, ACE_RW_Mutex>; +template class ACE_Map_Manager<long, Consumer_Handler *, ACE_RW_Mutex>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#endif /* ACE_HAS_THREADS */ diff --git a/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp b/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp index 888a0979a34..4159c840597 100644 --- a/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp +++ b/examples/ASX/UPIPE_Event_Server/Supplier_Router.cpp @@ -1,7 +1,7 @@ -#include "Supplier_Router.h" // $Id$ #include "Options.h" +#include "Supplier_Router.h" #if defined (ACE_HAS_THREADS) @@ -133,11 +133,11 @@ template class ACE_Svc_Handler<ACE_UPIPE_STREAM, ACE_MT_SYNCH>; template class ACE_TSS<ACE_Dynamic>; template class Peer_Handler<SUPPLIER_ROUTER, SUPPLIER_KEY>; template class Peer_Router<Supplier_Handler, SUPPLIER_KEY>; -template class ACE_Map_Iterator<SUPPLIER_KEY, Supplier_Handler *, ACE_Null_Mutex>; -template class ACE_Map_Manager<SUPPLIER_KEY, Supplier_Handler *, ACE_Null_Mutex>; -template class ACE_Read_Guard<ACE_Null_Mutex>; -template class ACE_Write_Guard<ACE_Null_Mutex>; -template class ACE_Guard<ACE_Null_Mutex>; +template class ACE_Map_Iterator<SUPPLIER_KEY, Supplier_Handler *, ACE_ACE_RW_Mutex>; +template class ACE_Map_Manager<SUPPLIER_KEY, Supplier_Handler *, ACE_ACE_RW_Mutex>; +template class ACE_Read_Guard<ACE_ACE_RW_Mutex>; +template class ACE_Write_Guard<ACE_ACE_RW_Mutex>; +template class ACE_Guard<ACE_ACE_RW_Mutex>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ #endif /* ACE_HAS_THREADS */ diff --git a/examples/Connection/misc/test_upipe.cpp b/examples/Connection/misc/test_upipe.cpp index bcee912716a..816b73b1714 100644 --- a/examples/Connection/misc/test_upipe.cpp +++ b/examples/Connection/misc/test_upipe.cpp @@ -1,12 +1,10 @@ -// This short program illustrates in implementation of the classic // $Id$ +// This short program illustrates in implementation of the classic // "bounded buffer" program using ACE_UPIPEs. This program also shows // how the ACE_Connector and ACE_Acceptor patterns work when used with // ACE_UPIPEs. -// Enable tracing - #include "ace/Acceptor.h" #include "ace/Connector.h" #include "ace/UPIPE_Acceptor.h" @@ -172,12 +170,6 @@ int main (int argc, char *argv[]) thr_mgr.wait (); return 0; } -#else -int -main (void) -{ - ACE_ERROR_RETURN ((LM_ERROR, "your platform does not support threads\n"), 1); -} #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Accept_Strategy<Server_Service, ACE_UPIPE_ACCEPTOR>; @@ -202,4 +194,10 @@ template class ACE_Thru_Task<ACE_NULL_SYNCH>; template class ACE_Write_Guard<ACE_Null_Mutex>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#else +int +main (void) +{ + ACE_ERROR_RETURN ((LM_ERROR, "your platform does not support threads\n"), 1); +} #endif /* ACE_HAS_THREADS */ diff --git a/examples/Connection/non_blocking/test_sock_connector.cpp b/examples/Connection/non_blocking/test_sock_connector.cpp index f297af8efcb..52f3d9a7b72 100644 --- a/examples/Connection/non_blocking/test_sock_connector.cpp +++ b/examples/Connection/non_blocking/test_sock_connector.cpp @@ -1,7 +1,5 @@ -// ACE_SOCK Client. // $Id$ - #include "ace/SOCK_Connector.h" #include "ace/INET_Addr.h" #include "CPP-connector.h" @@ -9,6 +7,8 @@ typedef Peer_Handler<ACE_SOCK_STREAM> PEER_HANDLER; typedef IPC_Client<PEER_HANDLER, ACE_SOCK_CONNECTOR> IPC_CLIENT; +// ACE_SOCK Client. + int main (int argc, char *argv[]) { @@ -23,12 +23,6 @@ main (int argc, char *argv[]) return peer_connector.svc (); } -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<PEER_HANDLER, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_SYNCH>; @@ -36,9 +30,9 @@ template class ACE_Svc_Tuple<PEER_HANDLER>; template class ACE_TSS<ACE_Dynamic>; template class IPC_Client<PEER_HANDLER, ACE_SOCK_CONNECTOR>; template class Peer_Handler<ACE_SOCK_STREAM>; -template class ACE_Guard<RW_MUTEX>; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<PEER_HANDLER> *, RW_MUTEX>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<PEER_HANDLER> *, RW_MUTEX>; -template class ACE_Read_Guard<RW_MUTEX>; -template class ACE_Write_Guard<RW_MUTEX>; +template class ACE_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Iterator<int, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<int, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Read_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/Connection/non_blocking/test_spipe_connector.cpp b/examples/Connection/non_blocking/test_spipe_connector.cpp index b540c954877..c629c7ddff7 100644 --- a/examples/Connection/non_blocking/test_spipe_connector.cpp +++ b/examples/Connection/non_blocking/test_spipe_connector.cpp @@ -23,21 +23,15 @@ main (int argc, char *argv[]) return peer_connector.svc (); } -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<PEER_HANDLER, ACE_SPIPE_CONNECTOR>; template class ACE_Svc_Handler<ACE_SPIPE_STREAM, ACE_SYNCH>; template class ACE_Svc_Tuple<PEER_HANDLER>; -template class ACE_Guard<RW_MUTEX>; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<PEER_HANDLER> *, RW_MUTEX>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<PEER_HANDLER> *, RW_MUTEX>; -template class ACE_Read_Guard<RW_MUTEX>; -template class ACE_Write_Guard<RW_MUTEX>; +template class ACE_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Iterator<int, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<int, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Read_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; template class ACE_TSS<ACE_Dynamic>; template class IPC_Client<PEER_HANDLER, ACE_SPIPE_CONNECTOR>; template class Peer_Handler<ACE_SPIPE_STREAM>; diff --git a/examples/Connection/non_blocking/test_tli_connector.cpp b/examples/Connection/non_blocking/test_tli_connector.cpp index 810c0645f6c..fc2ac9a7105 100644 --- a/examples/Connection/non_blocking/test_tli_connector.cpp +++ b/examples/Connection/non_blocking/test_tli_connector.cpp @@ -25,21 +25,15 @@ main (int argc, char *argv[]) return peer_connector.svc (); } -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<PEER_HANDLER, ACE_TLI_CONNECTOR>; template class ACE_Svc_Handler<ACE_TLI_STREAM, ACE_SYNCH>; template class ACE_Svc_Tuple<PEER_HANDLER>; -template class ACE_Guard<RW_MUTEX>; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<PEER_HANDLER> *, RW_MUTEX>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<PEER_HANDLER> *, RW_MUTEX>; -template class ACE_Read_Guard<RW_MUTEX>; -template class ACE_Write_Guard<RW_MUTEX>; +template class ACE_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Iterator<int, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<int, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Read_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; template class ACE_TSS<ACE_Dynamic>; template class IPC_Client<PEER_HANDLER, ACE_TLI_CONNECTOR>; template class Peer_Handler<ACE_TLI_STREAM>; diff --git a/examples/Logger/Acceptor-server/server_loggerd.cpp b/examples/Logger/Acceptor-server/server_loggerd.cpp index 3b28a29b408..7a7a13fc6ff 100644 --- a/examples/Logger/Acceptor-server/server_loggerd.cpp +++ b/examples/Logger/Acceptor-server/server_loggerd.cpp @@ -251,7 +251,6 @@ main (int argc, char *argv[]) return 0; } - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Acceptor<Logging_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Message_Queue<ACE_NULL_SYNCH>; diff --git a/examples/Misc/test_read_buffer.cpp b/examples/Misc/test_read_buffer.cpp index c661e4f1159..16e8fccd6d9 100644 --- a/examples/Misc/test_read_buffer.cpp +++ b/examples/Misc/test_read_buffer.cpp @@ -1,6 +1,6 @@ -#include "ace/Service_Config.h" // $Id$ +#include "ace/Service_Config.h" #include "ace/Read_Buffer.h" int @@ -22,9 +22,3 @@ main (int argc, char *argv[]) } return 0; } - -#if 0 -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) -template class ACE_Stream<ACE_Null_Mutex, ACE_Null_Condition_Mutex>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ -#endif diff --git a/examples/Reactor/Misc/pingpong.cpp b/examples/Reactor/Misc/pingpong.cpp index 3b515fc5d40..e3b1ead8c81 100644 --- a/examples/Reactor/Misc/pingpong.cpp +++ b/examples/Reactor/Misc/pingpong.cpp @@ -238,7 +238,6 @@ main (int argc, char *argv[]) return 0; } - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Test_and_Set<ACE_Null_Mutex, sig_atomic_t>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/Shared_Malloc/Malloc.cpp b/examples/Shared_Malloc/Malloc.cpp index c0ddc352df5..403d8325b23 100644 --- a/examples/Shared_Malloc/Malloc.cpp +++ b/examples/Shared_Malloc/Malloc.cpp @@ -3,30 +3,23 @@ #include "Malloc.h" -// Determine the type of dynamic memory manager. -#if defined (ACE_HAS_THREADS) -typedef ACE_Thread_Mutex THREAD_MUTEX; -#else -typedef ACE_Null_Mutex THREAD_MUTEX; -#endif /* ACE_HAS_THREADS */ - // Strategic typedefs for memory allocation. -typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX> L_ALLOCATOR; +typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX> L_ALLOCATOR; typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex> M_ALLOCATOR; #if defined (ACE_LACKS_SYSV_SHMEM) -typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, THREAD_MUTEX> SP_ALLOCATOR; -typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, THREAD_MUTEX> ST_ALLOCATOR; +typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> SP_ALLOCATOR; +typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> ST_ALLOCATOR; #else typedef ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex> SP_ALLOCATOR; -typedef ACE_Malloc <ACE_SHARED_MEMORY_POOL, THREAD_MUTEX> ST_ALLOCATOR; +typedef ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX> ST_ALLOCATOR; #endif /* ACE_LACKS_SYSV_SHMEM */ #if defined (ACE_LACKS_SBRK) -typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX> SB_ALLOCATOR; +typedef ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX> SB_ALLOCATOR; #else -typedef ACE_Malloc <ACE_SBRK_MEMORY_POOL, THREAD_MUTEX> SB_ALLOCATOR; +typedef ACE_Malloc <ACE_SBRK_MEMORY_POOL, ACE_SYNCH_MUTEX> SB_ALLOCATOR; #endif /* ACE_LACKS_SBRK */ // Singleton @@ -59,7 +52,6 @@ Malloc::instance (void) return Malloc::instance_; } - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Allocator_Adapter<L_ALLOCATOR>; template class ACE_Allocator_Adapter<M_ALLOCATOR>; @@ -67,23 +59,23 @@ template class ACE_Allocator_Adapter<SB_ALLOCATOR>; template class ACE_Allocator_Adapter<SP_ALLOCATOR>; template class ACE_Allocator_Adapter<ST_ALLOCATOR>; template class ACE_Guard<ACE_Process_Mutex>; -template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX>; +template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX>; template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex>; template class ACE_Read_Guard<ACE_Process_Mutex>; -template class ACE_Read_Guard<THREAD_MUTEX>; +template class ACE_Read_Guard<ACE_SYNCH_MUTEX>; template class ACE_Write_Guard<ACE_Process_Mutex>; -template class ACE_Write_Guard<THREAD_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_MUTEX>; #if defined (ACE_LACKS_SYSV_SHMEM) -template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, THREAD_MUTEX>; +template class ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX>; #else template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_Process_Mutex>; -template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, THREAD_MUTEX>; +template class ACE_Malloc <ACE_SHARED_MEMORY_POOL, ACE_SYNCH_MUTEX>; #endif /* ACE_LACKS_SYSV_SHMEM */ #if defined (ACE_LACKS_SBRK) -template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, THREAD_MUTEX>; +template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_SYNCH_MUTEX>; #else -template class ACE_Malloc <ACE_SBRK_MEMORY_POOL, THREAD_MUTEX>; +template class ACE_Malloc <ACE_SBRK_MEMORY_POOL, ACE_SYNCH_MUTEX>; #endif /* ACE_LACKS_SBRK */ #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/examples/Shared_Malloc/test_persistence.cpp b/examples/Shared_Malloc/test_persistence.cpp index 1afef0a4a60..bacef7f9c58 100644 --- a/examples/Shared_Malloc/test_persistence.cpp +++ b/examples/Shared_Malloc/test_persistence.cpp @@ -1,7 +1,6 @@ -// Test the persistence capabilities of the ACE shared memory manager. // $Id$ - +// Test the persistence capabilities of the ACE shared memory manager. #include "ace/Malloc.h" diff --git a/netsvcs/clients/Tokens/manual/manual.cpp b/netsvcs/clients/Tokens/manual/manual.cpp index 906653569aa..88d9ad5bf3d 100644 --- a/netsvcs/clients/Tokens/manual/manual.cpp +++ b/netsvcs/clients/Tokens/manual/manual.cpp @@ -345,7 +345,6 @@ STDIN_Token::create_proxy (const char *token, char type) return 0; } - int main (int argc, char* argv[]) { @@ -353,7 +352,6 @@ main (int argc, char* argv[]) return st.open (argc, argv); } - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Map_Manager<STDIN_Token::TID, ACE_Token_Collection *, ACE_Null_Mutex>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/netsvcs/lib/Client_Logging_Handler.cpp b/netsvcs/lib/Client_Logging_Handler.cpp index 8e600b16529..614ad15b25d 100644 --- a/netsvcs/lib/Client_Logging_Handler.cpp +++ b/netsvcs/lib/Client_Logging_Handler.cpp @@ -303,15 +303,9 @@ ACE_Client_Logging_Connector::resume (void) ACE_SVC_FACTORY_DEFINE (ACE_Client_Logging_Connector) -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<ACE_Client_Logging_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Tuple<ACE_Client_Logging_Handler>; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, RW_MUTEX>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, RW_MUTEX>; +template class ACE_Map_Iterator<int, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<int, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, ACE_SYNCH_RW_MUTEX>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/netsvcs/lib/Server_Logging_Handler.cpp b/netsvcs/lib/Server_Logging_Handler.cpp index 57a665da2c0..77d03d0094c 100644 --- a/netsvcs/lib/Server_Logging_Handler.cpp +++ b/netsvcs/lib/Server_Logging_Handler.cpp @@ -11,6 +11,14 @@ template <ACE_PEER_STREAM_1, class COUNTER, ACE_SYNCH_1> COUNTER ACE_Server_Logging_Handler<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_2>::request_count_ = (COUNTER) 0; #endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */ +int +ACE_Server_Logging_Acceptor::make_svc_handler (SERVER_LOGGING_HANDLER *&handler) +{ + ACE_NEW_RETURN (handler, SERVER_LOGGING_HANDLER (ACE_Service_Config::thr_mgr (), + &this->lock_)); + return 0; +} + int ACE_Server_Logging_Acceptor::parse_args (int argc, char *argv[]) { @@ -53,7 +61,8 @@ ACE_Server_Logging_Acceptor::init (int argc, // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). - if (this->open (this->service_addr_, ACE_Service_Config::reactor (), + if (this->open (this->service_addr_, + ACE_Service_Config::reactor (), 0, 0, 0, &this->scheduling_strategy_, "Logging Server", "ACE single-threaded logging service") == -1) @@ -80,7 +89,11 @@ ACE_Server_Logging_Acceptor::init (int argc, } template <ACE_PEER_STREAM_1, class COUNTER, ACE_SYNCH_1> -ACE_Server_Logging_Handler<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_2>::ACE_Server_Logging_Handler (ACE_Thread_Manager *) +ACE_Server_Logging_Handler<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_2>::ACE_Server_Logging_Handler + (ACE_Thread_Manager *, + ACE_SYNCH_MUTEX_T *lock) + : lock_ (*lock) + { this->host_name_[0] = '\0'; // Initialize to a known state. } @@ -89,16 +102,12 @@ template <ACE_PEER_STREAM_1, class COUNTER, ACE_SYNCH_1> int ACE_Server_Logging_Handler<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_2>::handle_logging_record (void) { ssize_t len; - // Lock used to serialize access to std output - // (this should be in the class, but the SunC++ compiler is broken...) - static ACE_SYNCH_MUTEX lock; - // Perform two recv's to emulate record-oriented semantiCLS. - // Note that this code is not entirely portable since it - // relies on the fact that sizeof (ssize_t) is the same - // on both the sender and receiver side. To correctly - // handle this is painful, and we leave it as an exercise - // for the reader ;-). + // Perform two recv's to emulate record-oriented semantics. Note + // that this code is not entirely portable since it relies on the + // fact that sizeof (ssize_t) is the same on both the sender and + // receiver side. To correctly handle this is painful, and we leave + // it as an exercise for the reader ;-). ssize_t n = this->peer ().recv (&len, sizeof len); @@ -134,7 +143,7 @@ ACE_Server_Logging_Handler<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_2>::handle_logg { // Serialize output, if necessary (i.e., if we are running // in separate threads). - // ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, lock, -1); + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); lp.print (this->host_name_, 0, stderr); } diff --git a/netsvcs/lib/Server_Logging_Handler.h b/netsvcs/lib/Server_Logging_Handler.h index 6a9445dfa9d..828443e6a27 100644 --- a/netsvcs/lib/Server_Logging_Handler.h +++ b/netsvcs/lib/Server_Logging_Handler.h @@ -34,7 +34,8 @@ class ACE_Server_Logging_Handler : public ACE_Svc_Handler<ACE_PEER_STREAM_2, ACE // Defines the classes that perform server logging daemon // functionality. public: - ACE_Server_Logging_Handler (ACE_Thread_Manager * = 0); + ACE_Server_Logging_Handler (ACE_Thread_Manager * = 0, + ACE_SYNCH_MUTEX_T *lock = 0); virtual int open (void * = 0); // Hook called by <Server_Logging_Acceptor> when connection is @@ -54,6 +55,9 @@ protected: char host_name_[MAXHOSTNAMELEN + 1]; // Name of the host we are connected to. + + ACE_SYNCH_MUTEX_T &lock_; + // Reference to the lock used to serialize output. }; #if !defined (ACE_HAS_TLI) @@ -79,10 +83,20 @@ public: virtual int init (int argc, char *argv[]); // Dynamic linking hook. +protected: int parse_args (int argc, char *argv[]); // Parse svc.conf arguments. + virtual int make_svc_handler (SERVER_LOGGING_HANDLER *&); + // Factory that creates a new <SERVER_LOGGING_HANDLER>. We need to + // specialize this since the <lock_> held by this Acceptor must be + // passed into the <SERVER_LOGGING_HANDLER>. + private: + ACE_SYNCH_MUTEX_T lock_; + // Lock used to serialize output by the various + // <ACE_Server_Logging_Handler>'s. + ACE_Schedule_All_Reactive_Strategy<SERVER_LOGGING_HANDLER> scheduling_strategy_; // The scheduling strategy is designed for Reactive services. }; diff --git a/netsvcs/lib/TS_Clerk_Handler.cpp b/netsvcs/lib/TS_Clerk_Handler.cpp index 6b744d9d7a3..590537c725d 100644 --- a/netsvcs/lib/TS_Clerk_Handler.cpp +++ b/netsvcs/lib/TS_Clerk_Handler.cpp @@ -591,21 +591,15 @@ ACE_TS_Clerk_Processor::resume (void) ACE_SVC_FACTORY_DEFINE (ACE_TS_Clerk_Processor) -#if defined (ACE_MT_SAFE) -typedef ACE_RW_Mutex RW_MUTEX; -#else -typedef ACE_Null_Mutex RW_MUTEX; -#endif /* ACE_MT_SAFE */ - #if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) template class ACE_Connector<ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Set_Node<ACE_TS_Clerk_Handler *>; template class ACE_Svc_Tuple<ACE_TS_Clerk_Handler>; template class ACE_Unbounded_Set<ACE_TS_Clerk_Handler *>; template class ACE_Unbounded_Set_Iterator<ACE_TS_Clerk_Handler *>; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, RW_MUTEX>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, RW_MUTEX>; -template class ACE_Guard<RW_MUTEX>; -template class ACE_Read_Guard<RW_MUTEX>; -template class ACE_Write_Guard<RW_MUTEX>; +template class ACE_Map_Iterator<int, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Map_Manager<int, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Read_Guard<ACE_SYNCH_RW_MUTEX>; +template class ACE_Write_Guard<ACE_SYNCH_RW_MUTEX>; #endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ diff --git a/tests/Timer_Queue_Test.cpp b/tests/Timer_Queue_Test.cpp index 1591cf8c7fe..1755a3aa09b 100644 --- a/tests/Timer_Queue_Test.cpp +++ b/tests/Timer_Queue_Test.cpp @@ -16,7 +16,7 @@ // command line arguments are needed to run the test. // // = AUTHOR -// Douglas C. Schmidt and Prashant Jain +// Douglas C. Schmidt, Prashant Jain, and Darrell Brunsch // // ============================================================================ @@ -45,7 +45,7 @@ randomize_array (int array[], size_t size) } // Number of iterations for the performance tests. -static int max_iterations = ACE_DEFAULT_TIMERS * 100 ; +static int max_iterations = ACE_DEFAULT_TIMERS * 100; // Keep track of the timer ids that were assigned to us. static int *timer_ids = 0; @@ -283,16 +283,16 @@ main (int argc, char *argv[]) if (argc > 1) max_iterations = ACE_OS::atoi (argv[1]); + // = Perform initializations. + // Preallocate memory. ACE_NEW_RETURN (timer_queues[0].queue_, ACE_Timer_Heap (ACE_DEFAULT_TIMERS, 1), -// ACE_Timer_Heap (max_iterations, 1), -1); // Don't preallocate memory. ACE_NEW_RETURN (timer_queues[1].queue_, ACE_Timer_Heap, -// ACE_Timer_Heap (max_iterations), -1); // Preallocate memory. |