diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-12-24 21:35:29 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-12-24 21:35:29 +0000 |
commit | 7a6d6d39c941f82e770afde209c17084e930f732 (patch) | |
tree | 597a1a019d4746445e1e317534693889b11fa5c4 | |
parent | 8fdb6b9ae6e6b57e18acb8efa1304d34a1981316 (diff) | |
download | ATCD-7a6d6d39c941f82e770afde209c17084e930f732.tar.gz |
ChangeLogTag:Mon Dec 24 08:08:40 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
41 files changed, 609 insertions, 284 deletions
diff --git a/ChangeLog b/ChangeLog index 781197023c6..76f7ea6ea17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,50 @@ Mon Dec 24 08:08:40 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + * performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp: + * performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp: + * examples/Threads/tss2.cpp: + * examples/Reactor/Misc/test_reactors.cpp: + * examples/Reactor/Proactor/post_completions.cpp: + * examples/Reactor/Proactor/test_timeout.cpp: + * examples/Threads/manual_event.cpp: + * examples/Threads/future1.cpp: + * examples/Threads/future2.cpp: + * examples/Threads/reader_writer.cpp: + * examples/Threads/task_two.cpp: + * tests/Atomic_Op_Test.cpp: + * tests/Auto_IncDec_Test.cpp: + * tests/Future_Set_Test.cpp: + * tests/Future_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/Message_Queue_Notifications_Test.cpp: + * tests/Notify_Performance_Test.cpp: + * tests/Reactors_Test.cpp: + * tests/Upgradable_RW_Test.cpp: + * tests/Reader_Writer_Test.cpp: + Added explicit template instantiation for ACE_Atomic_Op_Ex<>. + + * ace/Malloc_Allocator.cpp: Added explicit template instantiation + for ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int>. + + * ace/Atomic_Op.i, + * ace/Synch_T.{h,cpp}: Factored out some of the structure/logic + from ACE_Atomic_Op into a new base class called + ACE_Atomic_Op_Ex. Thanks to Alex Libman <alibman@@ihug.com.au> + for contributing this. + + * ace/Service_Config.cpp (close_singletons): Add support to close + the Proactor singleton, just like the Reactor singleton. Thanks + to Alex Libman <alibman@@ihug.com.au> for contributing this. + + * ace/WIN32_Proactor.cpp: Make sure to remove all the pending + results from the I/O completion port queue when we close down to + avoid memory leaks. Thanks to Alex Libman + <alibman@@ihug.com.au> for contribuging this. + + * ace/Proactor.{h,i,cpp}: Added Alex Libman's <alibman@@ihug.com.au> + enhancements that make the ACE_Proactor behave more like the + ACE_Reactor with respect to singletons etc. + * ace/Logging_Strategy.cpp * ace/Naming_Context.cpp * ace/Service_Manager.cpp: Removed the explicit template instantiations diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 781197023c6..76f7ea6ea17 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,5 +1,50 @@ Mon Dec 24 08:08:40 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + * performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp: + * performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp: + * examples/Threads/tss2.cpp: + * examples/Reactor/Misc/test_reactors.cpp: + * examples/Reactor/Proactor/post_completions.cpp: + * examples/Reactor/Proactor/test_timeout.cpp: + * examples/Threads/manual_event.cpp: + * examples/Threads/future1.cpp: + * examples/Threads/future2.cpp: + * examples/Threads/reader_writer.cpp: + * examples/Threads/task_two.cpp: + * tests/Atomic_Op_Test.cpp: + * tests/Auto_IncDec_Test.cpp: + * tests/Future_Set_Test.cpp: + * tests/Future_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/Message_Queue_Notifications_Test.cpp: + * tests/Notify_Performance_Test.cpp: + * tests/Reactors_Test.cpp: + * tests/Upgradable_RW_Test.cpp: + * tests/Reader_Writer_Test.cpp: + Added explicit template instantiation for ACE_Atomic_Op_Ex<>. + + * ace/Malloc_Allocator.cpp: Added explicit template instantiation + for ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int>. + + * ace/Atomic_Op.i, + * ace/Synch_T.{h,cpp}: Factored out some of the structure/logic + from ACE_Atomic_Op into a new base class called + ACE_Atomic_Op_Ex. Thanks to Alex Libman <alibman@@ihug.com.au> + for contributing this. + + * ace/Service_Config.cpp (close_singletons): Add support to close + the Proactor singleton, just like the Reactor singleton. Thanks + to Alex Libman <alibman@@ihug.com.au> for contributing this. + + * ace/WIN32_Proactor.cpp: Make sure to remove all the pending + results from the I/O completion port queue when we close down to + avoid memory leaks. Thanks to Alex Libman + <alibman@@ihug.com.au> for contribuging this. + + * ace/Proactor.{h,i,cpp}: Added Alex Libman's <alibman@@ihug.com.au> + enhancements that make the ACE_Proactor behave more like the + ACE_Reactor with respect to singletons etc. + * ace/Logging_Strategy.cpp * ace/Naming_Context.cpp * ace/Service_Manager.cpp: Removed the explicit template instantiations diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 781197023c6..76f7ea6ea17 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,5 +1,50 @@ Mon Dec 24 08:08:40 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + * performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp: + * performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp: + * examples/Threads/tss2.cpp: + * examples/Reactor/Misc/test_reactors.cpp: + * examples/Reactor/Proactor/post_completions.cpp: + * examples/Reactor/Proactor/test_timeout.cpp: + * examples/Threads/manual_event.cpp: + * examples/Threads/future1.cpp: + * examples/Threads/future2.cpp: + * examples/Threads/reader_writer.cpp: + * examples/Threads/task_two.cpp: + * tests/Atomic_Op_Test.cpp: + * tests/Auto_IncDec_Test.cpp: + * tests/Future_Set_Test.cpp: + * tests/Future_Test.cpp: + * tests/MEM_Stream_Test.cpp: + * tests/Message_Queue_Notifications_Test.cpp: + * tests/Notify_Performance_Test.cpp: + * tests/Reactors_Test.cpp: + * tests/Upgradable_RW_Test.cpp: + * tests/Reader_Writer_Test.cpp: + Added explicit template instantiation for ACE_Atomic_Op_Ex<>. + + * ace/Malloc_Allocator.cpp: Added explicit template instantiation + for ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int>. + + * ace/Atomic_Op.i, + * ace/Synch_T.{h,cpp}: Factored out some of the structure/logic + from ACE_Atomic_Op into a new base class called + ACE_Atomic_Op_Ex. Thanks to Alex Libman <alibman@@ihug.com.au> + for contributing this. + + * ace/Service_Config.cpp (close_singletons): Add support to close + the Proactor singleton, just like the Reactor singleton. Thanks + to Alex Libman <alibman@@ihug.com.au> for contributing this. + + * ace/WIN32_Proactor.cpp: Make sure to remove all the pending + results from the I/O completion port queue when we close down to + avoid memory leaks. Thanks to Alex Libman + <alibman@@ihug.com.au> for contribuging this. + + * ace/Proactor.{h,i,cpp}: Added Alex Libman's <alibman@@ihug.com.au> + enhancements that make the ACE_Proactor behave more like the + ACE_Reactor with respect to singletons etc. + * ace/Logging_Strategy.cpp * ace/Naming_Context.cpp * ace/Service_Manager.cpp: Removed the explicit template instantiations diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index d3ca8faf85a..15b6767e33b 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,13 @@ +Mon Dec 24 15:31:59 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * orbsvcs/orbsvcs/Event/EC_Gateway_UDP.cpp: + * orbsvcs/orbsvcs/Event/Event_Channel.cpp: + * orbsvcs/orbsvcs/Notify/Notify_AdminProperties.cpp: + * tao/DynamicInterface/ExceptionList.cpp: + * tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp: + * tao/PortableServer/Servant_Base.cpp: + Added explicit template instantiation for ACE_Atomic_Op_Ex<>. + Mon Dec 24 11:01:55 2001 Venkita Subramonian <venkita@cs.wustl.edu> * orbsvcs/tests/Notify/performance-tests/Throughput/Throughput.h: diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_UDP.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_UDP.cpp index e8e5dd84c30..6794818b7a5 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_UDP.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway_UDP.cpp @@ -1053,9 +1053,8 @@ TAO_ECG_UDP_EH::get_handle (void) const // **************************************************************** #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Atomic_Op<TAO_SYNCH_MUTEX,CORBA::ULong>; - +template class ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong>; +template class ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, CORBA::ULong>; template class ACE_Hash_Map_Manager<TAO_ECG_UDP_Request_Index,TAO_ECG_UDP_Request_Entry*,TAO_SYNCH_MUTEX>; template class ACE_Hash_Map_Manager_Ex<TAO_ECG_UDP_Request_Index, TAO_ECG_UDP_Request_Entry*, ACE_Hash<TAO_ECG_UDP_Request_Index>, ACE_Equal_To<TAO_ECG_UDP_Request_Index>, TAO_SYNCH_MUTEX>; template class ACE_Hash_Map_Entry<TAO_ECG_UDP_Request_Index,TAO_ECG_UDP_Request_Entry*>; @@ -1066,11 +1065,9 @@ template class ACE_Hash_Map_Iterator<TAO_ECG_UDP_Request_Index,TAO_ECG_UDP_Reque template class ACE_Hash_Map_Iterator_Ex<TAO_ECG_UDP_Request_Index, TAO_ECG_UDP_Request_Entry*, ACE_Hash<TAO_ECG_UDP_Request_Index>, ACE_Equal_To<TAO_ECG_UDP_Request_Index>, TAO_SYNCH_MUTEX>; template class ACE_Hash_Map_Reverse_Iterator<TAO_ECG_UDP_Request_Index,TAO_ECG_UDP_Request_Entry*,TAO_SYNCH_MUTEX>; template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_ECG_UDP_Request_Index, TAO_ECG_UDP_Request_Entry*, ACE_Hash<TAO_ECG_UDP_Request_Index>, ACE_Equal_To<TAO_ECG_UDP_Request_Index>, TAO_SYNCH_MUTEX>; - #elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX,CORBA::ULong> - +#pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> +#pragma instantiate ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, CORBA::ULong> #pragma instantiate ACE_Hash_Map_Manager<TAO_ECG_UDP_Request_Index,TAO_ECG_UDP_Request_Entry*,TAO_SYNCH_MUTEX> #pragma instantiate ACE_Hash_Map_Manager_Ex<TAO_ECG_UDP_Request_Index, TAO_ECG_UDP_Request_Entry*, ACE_Hash<TAO_ECG_UDP_Request_Index>, ACE_Equal_To<TAO_ECG_UDP_Request_Index>, TAO_SYNCH_MUTEX> #pragma instantiate ACE_Hash_Map_Entry<TAO_ECG_UDP_Request_Index,TAO_ECG_UDP_Request_Entry*> diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp index c45aae1d021..4d3a5f3bdde 100644 --- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp @@ -21,8 +21,8 @@ ACE_RCSID(Event, Event_Channel, "$Id$") #include "tao/Timeprobe.h" #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Atomic_Op<ACE_ES_MUTEX, int>; +template class ACE_Atomic_Op_Ex<ACE_ES_MUTEX, int>; template class ACE_Map_Entry<ACE_ES_Subscription_Info::EXT, ACE_ES_Subscription_Info::INT>; template class ACE_Map_Entry<ACE_ES_Subscription_Info::sEXT, ACE_ES_Subscription_Info::sINT>; template class ACE_Map_Entry<RtecEventChannelAdmin::Observer_Handle, ACE_EventChannel::Observer_Entry>; @@ -58,8 +58,8 @@ template class ACE_Array_Base<TAO_EC_Event>; template class ACE_Array_Iterator<TAO_EC_Event>; #elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Atomic_Op<ACE_ES_MUTEX, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_ES_MUTEX, int> #pragma instantiate ACE_Map_Entry<ACE_ES_Subscription_Info::EXT, ACE_ES_Subscription_Info::INT> #pragma instantiate ACE_Map_Entry<ACE_ES_Subscription_Info::sEXT, ACE_ES_Subscription_Info::sINT> #pragma instantiate ACE_Map_Entry<RtecEventChannelAdmin::Observer_Handle, ACE_EventChannel::Observer_Entry> diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_AdminProperties.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_AdminProperties.cpp index 2d71b2be604..07be5b1a491 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_AdminProperties.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_AdminProperties.cpp @@ -101,11 +101,9 @@ TAO_Notify_AdminProperties::queue_full (void) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Atomic_Op<TAO_SYNCH_MUTEX,int>; - +template class ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX,int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX,int> - +#pragma instantiate ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX,int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/DynamicInterface/ExceptionList.cpp b/TAO/tao/DynamicInterface/ExceptionList.cpp index 456b23b4a72..d399a022e06 100644 --- a/TAO/tao/DynamicInterface/ExceptionList.cpp +++ b/TAO/tao/DynamicInterface/ExceptionList.cpp @@ -103,19 +103,15 @@ CORBA_ExceptionList::_decr_refcnt (void) } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong>; - +template class ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, CORBA::ULong>; template class ACE_Node<CORBA::TypeCode_ptr>; template class ACE_Unbounded_Queue<CORBA::TypeCode_ptr>; template class ACE_Unbounded_Queue_Iterator<CORBA::TypeCode_ptr>; - #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> - +#pragma instantiate ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, CORBA::ULong> #pragma instantiate ACE_Node<CORBA::TypeCode_ptr> #pragma instantiate ACE_Unbounded_Queue<CORBA::TypeCode_ptr> #pragma instantiate ACE_Unbounded_Queue_Iterator<CORBA::TypeCode_ptr> - #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index 6a9ca1409a3..59a590cdf83 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -1,6 +1,5 @@ // $Id$ - #include "Servant_Base.h" #include "POA.h" #include "Operation_Table.h" @@ -407,11 +406,9 @@ TAO_Local_ServantBase::_dispatch (TAO_ServerRequest &, } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Atomic_Op<TAO_SYNCH_MUTEX, long>; - +template class ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, long>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> - +#pragma instantiate ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, long> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp index a9e5723dc47..8ceb71036e4 100644 --- a/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp +++ b/TAO/tests/Portable_Interceptors/Request_Interceptor_Flow/Request_Interceptor.cpp @@ -49,14 +49,10 @@ Request_Interceptor::destroy (TAO_ENV_SINGLE_ARG_DECL) } } - - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong>; - +template class ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, CORBA::ULong>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> - +#pragma instantiate ACE_Atomic_Op_Ex<TAO_SYNCH_MUTEX, CORBA::ULong> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ace/Atomic_Op.i b/ace/Atomic_Op.i index 1b5583c2828..524a455e188 100644 --- a/ace/Atomic_Op.i +++ b/ace/Atomic_Op.i @@ -2,130 +2,130 @@ // $Id$ template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (void) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (void) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return ++this->value_; } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+= (const TYPE &i) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+= (const TYPE &i) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator+="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator+="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_ += i; } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (void) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (void) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator--"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator--"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return --this->value_; } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-= (const TYPE &i) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-= (const TYPE &i) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_ -= i; } 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_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex"); *this = rhs; // Invoke the assignment operator. } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++ (int) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++ (int) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator++"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator++"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_++; } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator-- (int) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator-- (int) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator--"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator--"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_--; } template <class ACE_LOCK, class TYPE> ACE_INLINE int -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator== (const TYPE &i) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator== (const TYPE &i) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator=="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator=="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, -1); return this->value_ == i; } template <class ACE_LOCK, class TYPE> ACE_INLINE int -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!= (const TYPE &i) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!= (const TYPE &i) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator!="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator!="); return !(*this == i); } template <class ACE_LOCK, class TYPE> ACE_INLINE int -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>= (const TYPE &i) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>= (const TYPE &i) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, -1); return this->value_ >= i; } template <class ACE_LOCK, class TYPE> ACE_INLINE int -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator> (const TYPE &rhs) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator> (const TYPE &rhs) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator>"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator>"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, -1); return this->value_ > rhs; } template <class ACE_LOCK, class TYPE> ACE_INLINE int -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<= (const TYPE &rhs) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<= (const TYPE &rhs) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, -1); return this->value_ <= rhs; } template <class ACE_LOCK, class TYPE> ACE_INLINE int -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator< (const TYPE &rhs) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator< (const TYPE &rhs) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator<"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator<"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, -1); return this->value_ < rhs; } template <class ACE_LOCK, class TYPE> ACE_INLINE void -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator="); if (&rhs == this) return; // Avoid deadlock... ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_); - // This will call ACE_Atomic_Op::TYPE(), which will ensure the value + // This will call ACE_Atomic_Op_Ex::TYPE(), which will ensure the value // of <rhs> is acquired atomically. this->value_ = rhs.value (); } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE -ACE_Atomic_Op<ACE_LOCK, TYPE>::value (void) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value (void) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::value"); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, this->value_); return this->value_; } template <class ACE_LOCK, class TYPE> ACE_INLINE TYPE & -ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i (void) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::value_i (void) { // Explicitly return <value_> (by reference). This gives the user // full, unrestricted access to the underlying value. This method @@ -135,14 +135,30 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i (void) } template <class ACE_LOCK, class TYPE> ACE_INLINE void -ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const TYPE &i) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (const TYPE &i) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::operator="); +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator="); ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_); this->value_ = i; } -// These specializations have been added to ACE_Atomic_Op to make the +// +// ACE_Atomic_Op inline functions +// + +template <class ACE_LOCK, class TYPE> ACE_INLINE void +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const TYPE &i) +{ + ACE_Atomic_Op_Ex <ACE_LOCK,TYPE> ::operator= (i); +} + +template <class ACE_LOCK, class TYPE> ACE_INLINE void +ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs) +{ + ACE_Atomic_Op_Ex <ACE_LOCK,TYPE> ::operator= (rhs); +} + +// These specializations have been added to ACE_Atomic_Op_Ex to make the // implementation faster on Win32 that has OS support for doing this // quickly through methods like InterlockedIncrement and // InterlockedDecrement @@ -153,21 +169,21 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::operator= (const TYPE &i) ACE_TEMPLATE_SPECIALIZATION inline long -ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void) +ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>::operator++ (void) { return ::InterlockedIncrement (&this->value_); } ACE_TEMPLATE_SPECIALIZATION inline long -ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void) +ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>::operator-- (void) { return ::InterlockedDecrement (&this->value_); } ACE_TEMPLATE_SPECIALIZATION inline void -ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (const long &i) +ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>::operator= (const long &i) { ::InterlockedExchange (&this->value_, i); @@ -175,7 +191,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (const long &i) ACE_TEMPLATE_SPECIALIZATION inline void -ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &rhs) +ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>::operator= (const ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long> &rhs) { ::InterlockedExchange (&this->value_, rhs.value ()); @@ -185,14 +201,14 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (const ACE_Atomic_Op<ACE_Thread ACE_TEMPLATE_SPECIALIZATION inline long -ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (const long &i) +ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>::operator+= (const long &i) { return ::InterlockedExchangeAdd (&this->value_, i); } ACE_TEMPLATE_SPECIALIZATION inline long -ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (const long &i) +ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>::operator-= (const long &i) { return ::InterlockedExchangeAdd (&this->value_, -i); } diff --git a/ace/Malloc_Allocator.cpp b/ace/Malloc_Allocator.cpp index ca765c5befd..5f98c01746a 100644 --- a/ace/Malloc_Allocator.cpp +++ b/ace/Malloc_Allocator.cpp @@ -155,8 +155,10 @@ ACE_Malloc_Stats::dump (void) const #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>; +template class ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_HAS_MALLOC_STATS */ diff --git a/ace/PI_Malloc.cpp b/ace/PI_Malloc.cpp index e27f3d1f6a8..8299304f4fb 100644 --- a/ace/PI_Malloc.cpp +++ b/ace/PI_Malloc.cpp @@ -157,14 +157,6 @@ ACE_PI_Control_Block::ACE_Name_Node::dump (void) const } #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ -/* -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> -#endif *//* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -//#endif /* ACE_HAS_MALLOC_STATS */ - #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header>; diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp index 2ccf384cf82..647e8f7d498 100644 --- a/ace/Proactor.cpp +++ b/ace/Proactor.cpp @@ -4,7 +4,10 @@ #include "ace/Proactor_Impl.h" #include "ace/Object_Manager.h" #include "ace/Task_T.h" -#include "ace/Service_Config.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Proactor.i" +#endif /* __ACE_INLINE__ */ ACE_RCSID(ace, Proactor, "$Id$") @@ -20,20 +23,6 @@ ACE_RCSID(ace, Proactor, "$Id$") # include "ace/WIN32_Proactor.h" #endif /* ACE_HAS_AIO_CALLS */ -#if defined (ACE_HAS_SIG_C_FUNC) -extern "C" void -ACE_Proactor_cleanup (void *instance, void *arg) -{ - ACE_Proactor::cleanup (instance, arg); -} -#endif - -void -ACE_Proactor::cleanup (void *, void *) -{ - ACE_Proactor::close_singleton (); -} - // Process-wide ACE_Proactor. ACE_Proactor *ACE_Proactor::proactor_ = 0; @@ -41,12 +30,6 @@ ACE_Proactor *ACE_Proactor::proactor_ = 0; // only delete it safely if we created it!) int ACE_Proactor::delete_proactor_ = 0; -// Terminate the eventloop. -sig_atomic_t ACE_Proactor::end_event_loop_ = 0; - -// Number of threads in the event loop. -sig_atomic_t ACE_Proactor::event_loop_thread_count_ = 0; - class ACE_Export ACE_Proactor_Timer_Handler : public ACE_Task <ACE_NULL_SYNCH> { // = TITLE @@ -251,7 +234,9 @@ ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation, delete_implementation_ (delete_implementation), timer_handler_ (0), timer_queue_ (0), - delete_timer_queue_ (0) + delete_timer_queue_ (0), + end_event_loop_ (0), + event_loop_thread_count_ (0) { this->implementation (implementation); @@ -316,28 +301,13 @@ ACE_Proactor::instance (size_t /* threads */) 0); ACE_Proactor::delete_proactor_ = 1; - - // Register with the Object_Manager so that the wrapper to - // delete the proactor will be called when Object_Manager is - // being terminated. - -#if defined ACE_HAS_SIG_C_FUNC - ACE_Object_Manager::at_exit (ACE_Proactor::proactor_, - ACE_Proactor_cleanup, - 0); -#else - ACE_Object_Manager::at_exit (ACE_Proactor::proactor_, - ACE_Proactor::cleanup, - 0); -#endif /* ACE_HAS_SIG_C_FUNC */ - } } return ACE_Proactor::proactor_; } ACE_Proactor * -ACE_Proactor::instance (ACE_Proactor *r) +ACE_Proactor::instance (ACE_Proactor * r, int delete_proactor) { ACE_TRACE ("ACE_Proactor::instance"); @@ -346,24 +316,9 @@ ACE_Proactor::instance (ACE_Proactor *r) ACE_Proactor *t = ACE_Proactor::proactor_; - // We can't safely delete it since we don't know who created it! - ACE_Proactor::delete_proactor_ = 0; - - // Register with the Object_Manager so that the wrapper to - // delete the proactor will be called when Object_Manager is - // being terminated. - -#if defined ACE_HAS_SIG_C_FUNC - ACE_Object_Manager::at_exit (ACE_Proactor::proactor_, - ACE_Proactor_cleanup, - 0); -#else - ACE_Object_Manager::at_exit (ACE_Proactor::proactor_, - ACE_Proactor::cleanup, - 0); -#endif /* ACE_HAS_SIG_C_FUNC */ - + ACE_Proactor::delete_proactor_ = delete_proactor; ACE_Proactor::proactor_ = r; + return t; } @@ -377,6 +332,7 @@ ACE_Proactor::close_singleton (void) if (ACE_Proactor::delete_proactor_) { + delete ACE_Proactor::proactor_; ACE_Proactor::proactor_ = 0; ACE_Proactor::delete_proactor_ = 0; @@ -384,31 +340,21 @@ ACE_Proactor::close_singleton (void) } int -ACE_Proactor::run_event_loop (void) +ACE_Proactor::proactor_run_event_loop (PROACTOR_EVENT_HOOK eh) { + ACE_TRACE ("ACE_Proactor::proactor_run_event_loop"); int result = 0; - // Declaring the lock variable. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = - ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object - (ACE_Object_Manager::ACE_PROACTOR_EVENT_LOOP_LOCK); -#endif /* ACE_MT_SAFE */ - - // Early check. It is ok to do this without lock, since we care just - // whether it is zero or non-zero. - if (ACE_Proactor::end_event_loop_ != 0) - return 0; - - // First time you are in. Increment the thread count. { - // Obtain the lock in the MT environments. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); - // Increment the thread count. - ACE_Proactor::event_loop_thread_count_ ++; + // Early check. It is ok to do this without lock, since we care just + // whether it is zero or non-zero. + if (this->end_event_loop_ != 0) + return 0; + + // First time you are in. Increment the thread count. + this->event_loop_thread_count_ ++; } // Run the event loop. @@ -416,32 +362,35 @@ ACE_Proactor::run_event_loop (void) { // Check the end loop flag. It is ok to do this without lock, // since we care just whether it is zero or non-zero. - if (ACE_Proactor::end_event_loop_ != 0) + if (this->end_event_loop_ != 0) break; // <end_event_loop> is not set. Ready to do <handle_events>. - result = ACE_Proactor::instance ()->handle_events (); + result = this->handle_events (); + + if (eh != 0 && (*eh) (this,0)) + continue; if (ACE_Service_Config::reconfig_occurred ()) ACE_Service_Config::reconfigure (); - else if (result == -1) + if (result == -1) break; } // Leaving the event loop. Decrement the thread count. - // Obtain the lock in the MT environments. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + { + // Obtain the lock in the MT environments. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); - // Decrement the thread count. - ACE_Proactor::event_loop_thread_count_ --; + // Decrement the thread count. + this->event_loop_thread_count_ --; - if (ACE_Proactor::event_loop_thread_count_ > 0 - && ACE_Proactor::end_event_loop_ != 0) - ACE_Proactor::post_wakeup_completions (1); + if (this->event_loop_thread_count_ > 0 + && this->end_event_loop_ != 0) + this->proactor_post_wakeup_completions (1); + } return result; } @@ -449,127 +398,109 @@ ACE_Proactor::run_event_loop (void) // Handle events for -tv- time. handle_events updates -tv- to reflect // time elapsed, so do not return until -tv- == 0, or an error occurs. int -ACE_Proactor::run_event_loop (ACE_Time_Value &tv) +ACE_Proactor::proactor_run_event_loop (ACE_Time_Value & tv, + PROACTOR_EVENT_HOOK eh) { - ACE_TRACE ("ACE_Proactor::run_event_loop"); - + ACE_TRACE ("ACE_Proactor::proactor_run_event_loop"); int result = 0; - // Declaring the lock variable. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = - ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object - (ACE_Object_Manager::ACE_PROACTOR_EVENT_LOOP_LOCK); -#endif /* ACE_MT_SAFE */ - - // Early check. It is ok to do this without lock, since we care just - // whether it is zero or non-zero. - if (ACE_Proactor::end_event_loop_ != 0 - || tv == ACE_Time_Value::zero) - return 0; - - // First time you are in. Increment the thread count. { - // Obtain the lock in the MT environments. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); + + // Early check. It is ok to do this without lock, since we care just + // whether it is zero or non-zero. + if (this->end_event_loop_ != 0 + || tv == ACE_Time_Value::zero) + return 0; - // Increment the thread count. - ACE_Proactor::event_loop_thread_count_ ++; + // First time you are in. Increment the thread count. + this->event_loop_thread_count_ ++; } // Run the event loop. for (;;) { - // Check for end of loop. It is ok to do this without lock, + // Check the end loop flag. It is ok to do this without lock, // since we care just whether it is zero or non-zero. - if (ACE_Proactor::end_event_loop_ != 0 - || tv == ACE_Time_Value::zero) + if (this->end_event_loop_ != 0) break; // <end_event_loop> is not set. Ready to do <handle_events>. - result = ACE_Proactor::instance ()->handle_events (tv); + result = this->handle_events (tv); + + if (eh != 0 && (*eh) (this,0)) + continue; if (ACE_Service_Config::reconfig_occurred ()) ACE_Service_Config::reconfigure (); - // An error has occurred. - else if (result == -1) + if (result == -1) break; } // Leaving the event loop. Decrement the thread count. - // Obtain the lock in the MT environments. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ + { + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); - // Decrement the thread count. - ACE_Proactor::event_loop_thread_count_ --; + // Decrement the thread count. + this->event_loop_thread_count_ --; - if (ACE_Proactor::event_loop_thread_count_ > 0 - && ACE_Proactor::end_event_loop_ != 0) - ACE_Proactor::post_wakeup_completions (1); + if (this->event_loop_thread_count_ > 0 + && this->end_event_loop_ != 0) + this->proactor_post_wakeup_completions (1); + } return result; } int -ACE_Proactor::reset_event_loop(void) +ACE_Proactor::proactor_reset_event_loop(void) { - ACE_TRACE ("ACE_Proactor::reset_event_loop"); - - // Obtain the lock in MT environments. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE !=0) - ACE_Thread_Mutex *lock = - ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object - (ACE_Object_Manager::ACE_PROACTOR_EVENT_LOOP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif - ACE_Proactor::end_event_loop_ = 0; + ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop"); + + // Obtain the lock in the MT environments. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); + + this->end_event_loop_ = 0; return 0; } int -ACE_Proactor::end_event_loop (void) +ACE_Proactor::proactor_end_event_loop (void) { - ACE_TRACE ("ACE_Proactor::end_event_loop"); + ACE_TRACE ("ACE_Proactor::proactor_end_event_loop"); - // Obtain the lock, set the end flag and post the wakeup - // completions. + int how_many = 0; - // Obtain the lock in the MT environments. -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_Thread_Mutex *lock = - ACE_Managed_Object<ACE_Thread_Mutex>::get_preallocated_object - (ACE_Object_Manager::ACE_PROACTOR_EVENT_LOOP_LOCK); - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, *lock, -1); -#endif /* ACE_MT_SAFE */ - - // Set the end flag. - ACE_Proactor::end_event_loop_ = 1; + { + // Obtain the lock, set the end flag and post the wakeup + // completions. + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); - // Number of completions to post. - int how_many = ACE_Proactor::event_loop_thread_count_; + // Set the end flag. + ACE_Proactor::end_event_loop_ = 1; - if (how_many == 0) - return 0; + // Number of completions to post. + how_many = ACE_Proactor::event_loop_thread_count_; - // Reset the thread count. - // ACE_Proactor::event_loop_thread_count_ = 0; + if (how_many == 0) + return 0; + } // Post completions to all the threads so that they will all wake // up. - return ACE_Proactor::post_wakeup_completions (how_many); + return this->proactor_post_wakeup_completions (how_many); } int -ACE_Proactor::event_loop_done (void) +ACE_Proactor::proactor_event_loop_done (void) { - ACE_TRACE ("ACE_Proactor::event_loop_done"); - return ACE_Proactor::end_event_loop_ != 0; + ACE_TRACE ("ACE_Proactor::proactor_event_loop_done"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); + + return this->end_event_loop_ != 0 ? 1 : 0 ; } int @@ -648,10 +579,10 @@ ACE_Proactor::schedule_timer (ACE_Handler &handler, this->timer_queue_->gettimeofday () + time; // Only one guy goes in here at a time - ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, ace_mon, this->timer_queue_->mutex (), - -1); + -1)); // Schedule the timer long result = this->timer_queue_->schedule (&handler, @@ -795,7 +726,7 @@ ACE_Proactor::create_asynch_read_dgram (void) { return this->implementation ()->create_asynch_read_dgram (); } - + ACE_Asynch_Write_Dgram_Impl * ACE_Proactor::create_asynch_write_dgram (void) { @@ -951,7 +882,7 @@ ACE_Proactor::create_asynch_write_dgram_result (ACE_Handler &handler, const void* act, ACE_HANDLE event, int priority, - int signal_number) + int signal_number) { return this->implementation()->create_asynch_write_dgram_result (handler, handle, @@ -1035,9 +966,9 @@ ACE_Proactor::create_asynch_timer (ACE_Handler &handler, } int -ACE_Proactor::post_wakeup_completions (int how_many) +ACE_Proactor::proactor_post_wakeup_completions (int how_many) { - return ACE_Proactor::instance ()->implementation ()->post_wakeup_completions (how_many); + return this->implementation ()->post_wakeup_completions (how_many); } void diff --git a/ace/Proactor.h b/ace/Proactor.h index 172f987be97..ab458ac764e 100644 --- a/ace/Proactor.h +++ b/ace/Proactor.h @@ -9,6 +9,7 @@ * @author Irfan Pyarali <irfan@cs.wustl.edu> * @author Tim Harrison <harrison@cs.wustl.edu> * @author Alexander Babu Arulanthu <alex@cs.wustl.edu> + * @author Alexander Libman <alibman@@ihug.com.au> */ //============================================================================= @@ -162,7 +163,8 @@ public: /// Set pointer to a process-wide <ACE_Proactor> and return existing /// pointer. - static ACE_Proactor *instance (ACE_Proactor *); + static ACE_Proactor *instance (ACE_Proactor * proactor, + int delete_proactor = 0); /// Delete the dynamically allocated Singleton. static void close_singleton (void); @@ -204,6 +206,48 @@ public: /// Close the IO completion port. virtual int close (void); + /** + * You can add a hook to various run_event methods and the hook will + * be called after handling every proactor event. If this function + * returns 0, proactor_run_event_loop will check for the return value of + * handle_events. If it is -1, the the proactor_run_event_loop will return + * (pre-maturely.) + */ + typedef int (*PROACTOR_EVENT_HOOK)(ACE_Proactor *, void *); + + // These methods work with an instance of a proactor. + /** + * Run the event loop until the + * <ACE_Proactor::handle_events> + * method returns -1 or the <end_proactor_event_loop> method is invoked. + */ + virtual int proactor_run_event_loop (PROACTOR_EVENT_HOOK = 0); + + /** + * Run the event loop until the <ACE_Proactor::handle_events> + * method returns -1, the + * <end_proactor_event_loop> method is invoked, + * or the <ACE_Time_Value> + * expires. + */ + virtual int proactor_run_event_loop (ACE_Time_Value &tv, + PROACTOR_EVENT_HOOK = 0); + + /** + * Instruct the ACE_Proactor to terminate its event loop + * and notifies the ACE_Proactor so that it can wake up + * and close down gracefully. + */ + virtual int proactor_end_event_loop (void); + + /// Report if the ACE_Proactor event loop is finished. + virtual int proactor_event_loop_done (void); + + /// Resets the <ACE_Reactor::end_event_loop_> static so that the + /// <run_event_loop> method can be restarted. + virtual int proactor_reset_event_loop (void); + + /// This method adds the <handle> to the I/O completion port. This /// function is a no-op function for Unix systems and returns 0; virtual int register_handle (ACE_HANDLE handle, @@ -457,6 +501,13 @@ protected: */ static int post_wakeup_completions (int how_many); + /** + * Post <how_many> completions to the completion port so that all + * threads can wake up. This is used in conjunction with the + * <proactor_run_event_loop>. + */ + virtual int proactor_post_wakeup_completions (int how_many); + /// Set the implementation class. virtual void implementation (ACE_Proactor_Impl *implementation); @@ -487,10 +538,14 @@ protected: int delete_timer_queue_; /// Terminate the proactor event loop. - static sig_atomic_t end_event_loop_; + sig_atomic_t end_event_loop_; /// Number of threads in the event loop. - static sig_atomic_t event_loop_thread_count_; + sig_atomic_t event_loop_thread_count_; + + /// Mutex to protect work with lists. + ACE_SYNCH_MUTEX mutex_; + private: /// Deny access since member-wise won't work... @@ -530,5 +585,10 @@ public: static sig_atomic_t event_loop_done (void); }; #endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ + +#if defined (__ACE_INLINE__) +#include "ace/Proactor.i" +#endif /* __ACE_INLINE__ */ + #include "ace/post.h" #endif /* ACE_PROACTOR_H */ diff --git a/ace/Proactor.i b/ace/Proactor.i index 6318deb79a0..e876b6e8b0c 100644 --- a/ace/Proactor.i +++ b/ace/Proactor.i @@ -1,2 +1,74 @@ /* -*- C++ -*- */ // $Id$ + +int +ACE_Proactor::run_event_loop (void) +{ + ACE_TRACE ("ACE_Proactor::run_event_loop"); + ACE_Proactor *p = ACE_Proactor::instance (); + + if (p == 0) + return -1; + + return p->proactor_run_event_loop (); +} + +int +ACE_Proactor::run_event_loop (ACE_Time_Value &tv) +{ + ACE_TRACE ("ACE_Proactor::run_event_loop (tv)"); + ACE_Proactor *p = ACE_Proactor::instance (); + + if (p == 0) + return -1; + + return p->proactor_run_event_loop (tv); +} + +int +ACE_Proactor::reset_event_loop(void) +{ + ACE_TRACE ("ACE_Proactor::reset_event_loop"); + ACE_Proactor *p = ACE_Proactor::instance (); + + if (p == 0) + return -1; + + return p->proactor_reset_event_loop (); +} + +int +ACE_Proactor::end_event_loop (void) +{ + ACE_TRACE ("ACE_Proactor::end_event_loop"); + ACE_Proactor *p = ACE_Proactor::instance (); + + if (p == 0) + return -1; + + return p->proactor_end_event_loop (); +} + +int +ACE_Proactor::event_loop_done (void) +{ + ACE_TRACE ("ACE_Proactor::event_loop_done"); + ACE_Proactor *p = ACE_Proactor::instance (); + + if (p == 0) + return -1; + + return p->proactor_event_loop_done (); +} + +int +ACE_Proactor::post_wakeup_completions (int how_many) +{ + ACE_TRACE ("ACE_Proactor::post_wakeup_completions"); + ACE_Proactor *p = ACE_Proactor::instance (); + + if (p == 0) + return -1; + + return p->proactor_post_wakeup_completions (how_many); +} diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 0ddbb710d90..3f87398bfeb 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -10,6 +10,7 @@ #include "ace/Containers.h" #include "ace/Auto_Ptr.h" #include "ace/Reactor.h" +#include "ace/Proactor.h" #include "ace/Thread_Manager.h" #include "ace/Service_Config.h" @@ -830,6 +831,10 @@ ACE_Service_Config::close_singletons (void) ACE_Reactor::close_singleton (); +#if (((defined (ACE_HAS_WINNT)) && (ACE_HAS_WINNT == 1)) || (defined (ACE_HAS_AIO_CALLS))) + ACE_Proactor::close_singleton (); +#endif /* !ACE_HAS_WINCE */ + #if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) ACE_Thread_Manager::close_singleton (); #endif /* ! ACE_THREAD_MANAGER_LACKS_STATICS */ diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index 1abcca4a6db..bd63e0333e7 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -22,7 +22,8 @@ ACE_RCSID(ace, Synch_T, "$Id$") #endif /* !ACE_WIN32 */ #endif /* __ACE_INLINE__ */ -ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) +ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op_Ex) +ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) // This constructor isn't inlined, because SunPRO C++ 4.2 + patch // 104631-07 has trouble compiling TAO with it inline. @@ -40,36 +41,66 @@ ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::~ACE_Reverse_Lock (void) { } +// ************************************************* + template <class ACE_LOCK, class TYPE> ACE_LOCK & -ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex (void) +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::mutex (void) { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::mutex"); + // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::mutex"); return this->mutex_; } template <class ACE_LOCK, class TYPE> void -ACE_Atomic_Op<ACE_LOCK, TYPE>::dump (void) const +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::dump (void) const { -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::dump"); - + // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); this->mutex_.dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -template <class ACE_LOCK, class TYPE> -ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (void) - : value_ (0) -{ -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); -} - -template <class ACE_LOCK, class TYPE> -ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (const TYPE &c) - : value_ (c) -{ -// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); -} +template <class ACE_LOCK, class TYPE> +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex + (ACE_LOCK &mtx) + : mutex_ (mtx), + value_ (0) +{ + // ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex"); +} + +template <class ACE_LOCK, class TYPE> +ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex + (ACE_LOCK &mtx, const TYPE &c) + : mutex_ (mtx), + value_ (c) +{ +// ACE_TRACE ("ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::ACE_Atomic_Op_Ex"); +} + +// **************************************************************** + +template <class ACE_LOCK, class TYPE> +ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (void) + : ACE_Atomic_Op_Ex < ACE_LOCK,TYPE > (this->own_mutex_) +{ + // ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); +} + +template <class ACE_LOCK, class TYPE> +ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (const TYPE &c) + : ACE_Atomic_Op_Ex < ACE_LOCK,TYPE > (this->own_mutex_, c) +{ + // ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); +} + +template <class ACE_LOCK, class TYPE> ACE_INLINE +ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op + (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs) + : ACE_Atomic_Op_Ex < ACE_LOCK,TYPE > + ( this->own_mutex_, rhs.value() ) +{ +// ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); +} // **************************************************************** // ACE_ALLOC_HOOK_DEFINE(ACE_Guard) diff --git a/ace/Synch_T.h b/ace/Synch_T.h index b26bb7cd60e..e09aea59650 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -202,7 +202,7 @@ private: }; /** - * @class ACE_Atomic_Op + * @class ACE_Atomic_Op_Ex * * @brief Transparently parameterizes synchronization into basic * arithmetic operations. @@ -212,17 +212,17 @@ private: * templatized version of the Decorator pattern from the GoF book. */ template <class ACE_LOCK, class TYPE> -class ACE_Atomic_Op +class ACE_Atomic_Op_Ex { public: // = Initialization methods. - /// Initialize <value_> to 0. - ACE_Atomic_Op (void); - - /// Initialize <value_> to c. - ACE_Atomic_Op (const TYPE &c); - + /// Initialize <value_> to 0. + ACE_Atomic_Op_Ex (ACE_LOCK &mtx); + + /// Initialize <value_> to c. + ACE_Atomic_Op_Ex (ACE_LOCK &mtx, const TYPE &c); + // = Accessors. /// Atomically pre-increment <value_>. @@ -265,7 +265,7 @@ public: void operator= (const TYPE &i); /// Atomically assign <rhs> to <value_>. - void operator= (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs); + void operator= (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs); /// Explicitly return <value_>. TYPE value (void) const; @@ -277,7 +277,7 @@ public: // Declare the dynamic allocation hooks. /// Manage copying... - ACE_Atomic_Op (const ACE_Atomic_Op<ACE_LOCK, TYPE> &); + ACE_Atomic_Op_Ex (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &); /** * Returns a reference to the underlying <ACE_LOCK>. This makes it @@ -298,12 +298,36 @@ public: private: /// Type of synchronization mechanism. - ACE_LOCK mutex_; + ACE_LOCK &mutex_; /// Current object decorated by the atomic op. TYPE value_; }; +template <class ACE_LOCK, class TYPE> +class ACE_Atomic_Op : public ACE_Atomic_Op_Ex <ACE_LOCK, TYPE> +{ +public: + /// Initialize <value_> to 0. + ACE_Atomic_Op (void); + + /// Initialize <value_> to c. + ACE_Atomic_Op (const TYPE &c); + + /// Manage copying... + ACE_Atomic_Op (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &); + + /// Atomically assign i to <value_>. + void operator= (const TYPE &i); + + /// Atomically assign <rhs> to <value_>. + void operator= (const ACE_Atomic_Op_Ex<ACE_LOCK, TYPE> &rhs); + +private: + /// Type of synchronization mechanism. + ACE_LOCK own_mutex_; +}; + /** * @class ACE_TSS * diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp index 96196418e0c..9f0ccfccc2c 100644 --- a/ace/WIN32_Proactor.cpp +++ b/ace/WIN32_Proactor.cpp @@ -65,6 +65,31 @@ ACE_WIN32_Proactor::close (void) // Close the completion port if (this->completion_port_ != 0) { + // To avoid memory leaks we should delete all results from queue. + + for (;;) + { + ACE_OVERLAPPED *overlapped = 0; + u_long bytes_transferred = 0; + u_long completion_key = 0; + + // Get the next asynchronous operation that completes + BOOL res = ::GetQueuedCompletionStatus + (this->completion_port_, + &bytes_transferred, + &completion_key, + &overlapped, + 0); // poll + + if (overlapped == 0) + break; + + ACE_WIN32_Asynch_Result *asynch_result = + (ACE_WIN32_Asynch_Result *) overlapped; + + delete asynch_result; + } + int result = ACE_OS::close (this->completion_port_); this->completion_port_ = 0; return result; diff --git a/examples/Reactor/Misc/test_reactors.cpp b/examples/Reactor/Misc/test_reactors.cpp index 75467c2d4e4..39b50859311 100644 --- a/examples/Reactor/Misc/test_reactors.cpp +++ b/examples/Reactor/Misc/test_reactors.cpp @@ -185,11 +185,12 @@ main (int, char *[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - #else int main (int, char *[]) diff --git a/examples/Reactor/Proactor/post_completions.cpp b/examples/Reactor/Proactor/post_completions.cpp index 0f3ba203355..307bfdb9390 100644 --- a/examples/Reactor/Proactor/post_completions.cpp +++ b/examples/Reactor/Proactor/post_completions.cpp @@ -293,9 +293,11 @@ main (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Task <ACE_NULL_SYNCH>; template class ACE_Atomic_Op <ACE_Thread_Mutex, size_t>; +template class ACE_Atomic_Op_Ex <ACE_Thread_Mutex, size_t>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Task <ACE_NULL_SYNCH> #pragma instantiate ACE_Atomic_Op <ACE_Thread_Mutex, size_t> +#pragma instantiate ACE_Atomic_Op_Ex <ACE_Thread_Mutex, size_t> #endif /* ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA */ #else /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ diff --git a/examples/Reactor/Proactor/test_timeout.cpp b/examples/Reactor/Proactor/test_timeout.cpp index 18884b294e0..4c23c3781d5 100644 --- a/examples/Reactor/Proactor/test_timeout.cpp +++ b/examples/Reactor/Proactor/test_timeout.cpp @@ -115,8 +115,10 @@ main (int, char *[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #else /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS && !ACE_POSIX_AIOCB_PROACTOR*/ diff --git a/examples/Threads/future1.cpp b/examples/Threads/future1.cpp index 3ede3c3043e..42e6b4c2abe 100644 --- a/examples/Threads/future1.cpp +++ b/examples/Threads/future1.cpp @@ -392,6 +392,7 @@ main (int, ACE_TCHAR *[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Future<const char *>; template class ACE_Future<u_long>; template class ACE_Future_Rep<const char *>; @@ -406,6 +407,7 @@ template class ACE_Unbounded_Set_Iterator<ACE_Future_Observer<const char *> *>; template class ACE_Unbounded_Set_Iterator<ACE_Future_Observer<u_long> *>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Future<const char *> #pragma instantiate ACE_Future<u_long> #pragma instantiate ACE_Future_Rep<const char *> diff --git a/examples/Threads/future2.cpp b/examples/Threads/future2.cpp index 3cb49c7692a..ae848c3819f 100644 --- a/examples/Threads/future2.cpp +++ b/examples/Threads/future2.cpp @@ -514,6 +514,7 @@ main (int, ACE_TCHAR *[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Future<char *>; template class ACE_Future<u_long>; template class ACE_Future_Rep<char *>; @@ -528,6 +529,7 @@ template class ACE_Unbounded_Set_Iterator<ACE_Future_Observer<char *> *>; template class ACE_Unbounded_Set_Iterator<ACE_Future_Observer<u_long> *>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Future<char *> #pragma instantiate ACE_Future<u_long> #pragma instantiate ACE_Future_Rep<char *> diff --git a/examples/Threads/manual_event.cpp b/examples/Threads/manual_event.cpp index ec273da90cc..cb55c7dd028 100644 --- a/examples/Threads/manual_event.cpp +++ b/examples/Threads/manual_event.cpp @@ -102,8 +102,10 @@ main (int argc, ACE_TCHAR **argv) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #else diff --git a/examples/Threads/reader_writer.cpp b/examples/Threads/reader_writer.cpp index a39d1f19d34..cd3bdc54b8a 100644 --- a/examples/Threads/reader_writer.cpp +++ b/examples/Threads/reader_writer.cpp @@ -176,17 +176,18 @@ int main (int argc, ACE_TCHAR *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Guard<ACE_RW_Mutex>; template class ACE_Read_Guard<ACE_RW_Mutex>; template class ACE_Write_Guard<ACE_RW_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Guard<ACE_RW_Mutex> #pragma instantiate ACE_Read_Guard<ACE_RW_Mutex> #pragma instantiate ACE_Write_Guard<ACE_RW_Mutex> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - #else int main (int, ACE_TCHAR *[]) diff --git a/examples/Threads/task_two.cpp b/examples/Threads/task_two.cpp index 1a66a31b2f9..5b1e04cd962 100644 --- a/examples/Threads/task_two.cpp +++ b/examples/Threads/task_two.cpp @@ -138,8 +138,10 @@ main (int argc, ACE_TCHAR *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/Threads/tss2.cpp b/examples/Threads/tss2.cpp index ef67ce1b7fb..c72bc1b8fb8 100644 --- a/examples/Threads/tss2.cpp +++ b/examples/Threads/tss2.cpp @@ -174,14 +174,18 @@ main (int argc, ACE_TCHAR *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Atomic_Op<ACE_Token, int>; +template class ACE_Atomic_Op_Ex<ACE_Token, int>; template class ACE_Guard<ACE_Token>; template class ACE_TSS<TSS_Data>; template class ACE_TSS<TSS_Obj>; template class ACE_TSS_Singleton<TSS_Data, ACE_SYNCH_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Atomic_Op<ACE_Token, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Token, int> #pragma instantiate ACE_Guard<ACE_Token> #pragma instantiate ACE_TSS<TSS_Data> #pragma instantiate ACE_TSS<TSS_Obj> diff --git a/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp b/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp index d87fcc3655d..2c39019e811 100644 --- a/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp +++ b/performance-tests/Synch-Benchmarks/Perf_Test/Performance_Test_Options.cpp @@ -468,9 +468,11 @@ Performance_Test_Options::print_results (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) #if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) template class ACE_Atomic_Op<ACE_Thread_Mutex, size_t>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, size_t>; #endif /* ACE_MT_SAFE */ #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, size_t> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, size_t> #endif /* ACE_MT_SAFE */ #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp b/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp index 26c0e650856..746f74cdca5 100644 --- a/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp +++ b/performance-tests/Synch-Benchmarks/Synch_Lib/Benchmark_Base.cpp @@ -90,9 +90,11 @@ Thr_ID::thr_id (int i) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_TSS<Thr_ID>; template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_TSS<Thr_ID> #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_HAS_PTHREADS || ACE_HAS_DCETHREADS || VXWORKS */ diff --git a/tests/Atomic_Op_Test.cpp b/tests/Atomic_Op_Test.cpp index c2d7712ca7f..ba8a3ad63c8 100644 --- a/tests/Atomic_Op_Test.cpp +++ b/tests/Atomic_Op_Test.cpp @@ -56,8 +56,10 @@ main (int, ACE_TCHAR *[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, long>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, long> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #else diff --git a/tests/Auto_IncDec_Test.cpp b/tests/Auto_IncDec_Test.cpp index 169ec22b58e..5c52410ade5 100644 --- a/tests/Auto_IncDec_Test.cpp +++ b/tests/Auto_IncDec_Test.cpp @@ -66,9 +66,11 @@ worker (void *) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Auto_IncDec<ACE_Atomic_Op<ACE_Thread_Mutex, int> >; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Auto_IncDec<ACE_Atomic_Op<ACE_Thread_Mutex, int> > #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Future_Set_Test.cpp b/tests/Future_Set_Test.cpp index 1e833fa2b69..9dde2480069 100644 --- a/tests/Future_Set_Test.cpp +++ b/tests/Future_Set_Test.cpp @@ -364,8 +364,8 @@ typedef ACE_Future_Rep<const ACE_TCHAR *> *char_star_key; typedef ACE_Future_Holder<const ACE_TCHAR *> *char_star_value; #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Future_Holder<const ACE_TCHAR *>; template class ACE_Future_Holder<u_long>; template class ACE_Future_Observer<const ACE_TCHAR *>; @@ -398,10 +398,9 @@ template class ACE_Hash_Map_Manager_Ex<char_star_key, char_star_value, ACE_Point template class ACE_Hash_Map_Iterator_Base_Ex<char_star_key, char_star_value, ACE_Pointer_Hash<char_star_key>, ACE_Equal_To<char_star_key>, ACE_Null_Mutex>; template class ACE_Hash_Map_Iterator_Ex<char_star_key, char_star_value, ACE_Pointer_Hash<char_star_key>, ACE_Equal_To<char_star_key>, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator_Ex<char_star_key, char_star_value, ACE_Pointer_Hash<char_star_key>, ACE_Equal_To<char_star_key>, ACE_Null_Mutex>; - #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Future_Holder<const ACE_TCHAR *> #pragma instantiate ACE_Future_Holder<u_long> #pragma instantiate ACE_Future_Observer<const ACE_TCHAR *> diff --git a/tests/Future_Test.cpp b/tests/Future_Test.cpp index 2391ad99f07..e1bd518ccdc 100644 --- a/tests/Future_Test.cpp +++ b/tests/Future_Test.cpp @@ -366,6 +366,7 @@ static int n_loops = 100; #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Future<const ACE_TCHAR *>; template class ACE_Future<int>; template class ACE_Future<u_long>; @@ -385,6 +386,7 @@ template class ACE_Unbounded_Set_Iterator<ACE_Future_Observer<int> *>; template class ACE_Unbounded_Set_Iterator<ACE_Future_Observer<u_long> *>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Future<const ACE_TCHAR *> #pragma instantiate ACE_Future<int> #pragma instantiate ACE_Future<u_long> diff --git a/tests/MEM_Stream_Test.cpp b/tests/MEM_Stream_Test.cpp index 3984085a5af..edf8b8844fd 100644 --- a/tests/MEM_Stream_Test.cpp +++ b/tests/MEM_Stream_Test.cpp @@ -476,6 +476,7 @@ main (int argc, ACE_TCHAR *argv[]) template class ACE_Svc_Handler <ACE_MEM_STREAM, ACE_SYNCH>; template class ACE_Acceptor<Echo_Handler, ACE_MEM_ACCEPTOR>; template class ACE_Atomic_Op<ACE_SYNCH_MUTEX, u_short>; +template class ACE_Atomic_Op_Ex<ACE_SYNCH_MUTEX, u_short>; template class ACE_Singleton<ACE_Atomic_Op<ACE_SYNCH_MUTEX, u_short>, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Accept_Strategy<Echo_Handler, ACE_MEM_ACCEPTOR>; template class ACE_Creation_Strategy<Echo_Handler>; @@ -490,6 +491,7 @@ template class ACE_Thread_Strategy<Echo_Handler>; #pragma instantiate ACE_Svc_Handler <ACE_MEM_STREAM, ACE_SYNCH> #pragma instantiate ACE_Acceptor<Echo_Handler, ACE_MEM_ACCEPTOR> #pragma instantiate ACE_Atomic_Op<ACE_SYNCH_MUTEX, u_short> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_SYNCH_MUTEX, u_short> #pragma instantiate ACE_Singleton<ACE_Atomic_Op<ACE_SYNCH_MUTEX, u_short>, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate ACE_Accept_Strategy<Echo_Handler, ACE_MEM_ACCEPTOR> #pragma instantiate ACE_Creation_Strategy<Echo_Handler> diff --git a/tests/Message_Queue_Notifications_Test.cpp b/tests/Message_Queue_Notifications_Test.cpp index 863faa68951..c373e2ae3e3 100644 --- a/tests/Message_Queue_Notifications_Test.cpp +++ b/tests/Message_Queue_Notifications_Test.cpp @@ -357,6 +357,8 @@ main (int, ACE_TCHAR *[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_SYNCH_MUTEX, int>; +template class ACE_Atomic_Op_Ex<ACE_SYNCH_MUTEX, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_SYNCH_MUTEX, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_SYNCH_MUTEX, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Notify_Performance_Test.cpp b/tests/Notify_Performance_Test.cpp index e7b69065eec..df5270e6d33 100644 --- a/tests/Notify_Performance_Test.cpp +++ b/tests/Notify_Performance_Test.cpp @@ -232,12 +232,14 @@ template class ACE_Auto_Basic_Ptr<ACE_Reactor>; template class auto_ptr<ACE_Reactor_Impl>; template class ACE_Auto_Basic_Ptr<ACE_Reactor_Impl>; template class ACE_Atomic_Op<ACE_Thread_Mutex, long>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate auto_ptr<ACE_Reactor> #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Reactor> #pragma instantiate auto_ptr<ACE_Reactor_Impl> #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Reactor_Impl> #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, long> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, long> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #else diff --git a/tests/Reactors_Test.cpp b/tests/Reactors_Test.cpp index e9b02b09cfb..cedaa209416 100644 --- a/tests/Reactors_Test.cpp +++ b/tests/Reactors_Test.cpp @@ -199,8 +199,10 @@ worker (void *args) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_HAS_THREADS */ diff --git a/tests/Reader_Writer_Test.cpp b/tests/Reader_Writer_Test.cpp index d70f644f40a..3b8a9ac15bf 100644 --- a/tests/Reader_Writer_Test.cpp +++ b/tests/Reader_Writer_Test.cpp @@ -238,14 +238,15 @@ writer (void *) return 0; } - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Read_Guard<ACE_RW_Mutex>; template class ACE_Write_Guard<ACE_RW_Mutex>; template class ACE_Guard<ACE_RW_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Read_Guard<ACE_RW_Mutex> #pragma instantiate ACE_Write_Guard<ACE_RW_Mutex> #pragma instantiate ACE_Guard<ACE_RW_Mutex> diff --git a/tests/Upgradable_RW_Test.cpp b/tests/Upgradable_RW_Test.cpp index ae2459cfa4e..ca19827d112 100644 --- a/tests/Upgradable_RW_Test.cpp +++ b/tests/Upgradable_RW_Test.cpp @@ -339,11 +339,13 @@ init (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; +template class ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int>; template class ACE_Read_Guard<ACE_RW_Mutex>; template class ACE_Write_Guard<ACE_RW_Mutex>; template class ACE_Guard<ACE_RW_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> +#pragma instantiate ACE_Atomic_Op_Ex<ACE_Thread_Mutex, int> #pragma instantiate ACE_Read_Guard<ACE_RW_Mutex> #pragma instantiate ACE_Write_Guard<ACE_RW_Mutex> #pragma instantiate ACE_Guard<ACE_RW_Mutex> |