From 4b62b2711f6b2132099aa6a46a1e86eb68c9e87d Mon Sep 17 00:00:00 2001 From: nanbor Date: Fri, 13 Apr 2001 17:11:47 +0000 Subject: ChangeLogTag:Fri Apr 13 12:05:38 2001 Nanbor Wang --- ChangeLog | 20 ++++++++++++++------ ChangeLogs/ChangeLog-02a | 20 ++++++++++++++------ ChangeLogs/ChangeLog-03a | 20 ++++++++++++++------ tests/MEM_Stream_Test.cpp | 35 +++++++++++++++++++++-------------- tests/MEM_Stream_Test.h | 7 ------- 5 files changed, 63 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 163db36a03b..b5712152655 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,17 @@ +Fri Apr 13 12:05:38 2001 Nanbor Wang + + * tests/MEM_Stream_Test.cpp: Borland C++ has problem cleaning up + the static Atomic_Op object in Echo_Handler in the right order. + Made that an ACE_Singleton and re-organized the test a big. + Thanks to Chris Kohlhoff for reporting and + suggesting the fix. [Bug 862] + Fri Apr 13 05:30:04 2001 Douglas C. Schmidt * ace/Malloc_T.{h,i}: Added support for one of the calloc() methods to ACE_Cached_Allocator. Thanks to Rachel G Smith for motivating this change. - + * ace/Malloc_Allocator.h: Updated the comments for ACE_New_Allocator to indicate that the calloc() methods are also supported. Thanks to Rachel G Smith for @@ -57,17 +65,17 @@ Thu Apr 12 13:06:27 2001 Joel Sherrill * include/makeinclude/Makefile.rtems: Replaced debug version with real version that queries RTEMS application Makefile infrastructure. - - * include/makeinclude/platform_rtems.x_g++.GNU: Added + + * include/makeinclude/platform_rtems.x_g++.GNU: Added --no-print-directory option to all invocations of recursive make to determine information from Makefile.rtems. This avoids getting the "entering/exiting directory" messages included in the results. - - * ACE-RTEMS.README: Added requirement to configure C++ + + * ACE-RTEMS.README: Added requirement to configure C++ support in RTEMS. Updated to reflect also compiling for mc68360 target. - + Wed Apr 11 20:36:36 2001 Nanbor Wang * examples/Synch/proc_sema.cpp (main): Fixd an assigning string diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 163db36a03b..b5712152655 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,9 +1,17 @@ +Fri Apr 13 12:05:38 2001 Nanbor Wang + + * tests/MEM_Stream_Test.cpp: Borland C++ has problem cleaning up + the static Atomic_Op object in Echo_Handler in the right order. + Made that an ACE_Singleton and re-organized the test a big. + Thanks to Chris Kohlhoff for reporting and + suggesting the fix. [Bug 862] + Fri Apr 13 05:30:04 2001 Douglas C. Schmidt * ace/Malloc_T.{h,i}: Added support for one of the calloc() methods to ACE_Cached_Allocator. Thanks to Rachel G Smith for motivating this change. - + * ace/Malloc_Allocator.h: Updated the comments for ACE_New_Allocator to indicate that the calloc() methods are also supported. Thanks to Rachel G Smith for @@ -57,17 +65,17 @@ Thu Apr 12 13:06:27 2001 Joel Sherrill * include/makeinclude/Makefile.rtems: Replaced debug version with real version that queries RTEMS application Makefile infrastructure. - - * include/makeinclude/platform_rtems.x_g++.GNU: Added + + * include/makeinclude/platform_rtems.x_g++.GNU: Added --no-print-directory option to all invocations of recursive make to determine information from Makefile.rtems. This avoids getting the "entering/exiting directory" messages included in the results. - - * ACE-RTEMS.README: Added requirement to configure C++ + + * ACE-RTEMS.README: Added requirement to configure C++ support in RTEMS. Updated to reflect also compiling for mc68360 target. - + Wed Apr 11 20:36:36 2001 Nanbor Wang * examples/Synch/proc_sema.cpp (main): Fixd an assigning string diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 163db36a03b..b5712152655 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,9 +1,17 @@ +Fri Apr 13 12:05:38 2001 Nanbor Wang + + * tests/MEM_Stream_Test.cpp: Borland C++ has problem cleaning up + the static Atomic_Op object in Echo_Handler in the right order. + Made that an ACE_Singleton and re-organized the test a big. + Thanks to Chris Kohlhoff for reporting and + suggesting the fix. [Bug 862] + Fri Apr 13 05:30:04 2001 Douglas C. Schmidt * ace/Malloc_T.{h,i}: Added support for one of the calloc() methods to ACE_Cached_Allocator. Thanks to Rachel G Smith for motivating this change. - + * ace/Malloc_Allocator.h: Updated the comments for ACE_New_Allocator to indicate that the calloc() methods are also supported. Thanks to Rachel G Smith for @@ -57,17 +65,17 @@ Thu Apr 12 13:06:27 2001 Joel Sherrill * include/makeinclude/Makefile.rtems: Replaced debug version with real version that queries RTEMS application Makefile infrastructure. - - * include/makeinclude/platform_rtems.x_g++.GNU: Added + + * include/makeinclude/platform_rtems.x_g++.GNU: Added --no-print-directory option to all invocations of recursive make to determine information from Makefile.rtems. This avoids getting the "entering/exiting directory" messages included in the results. - - * ACE-RTEMS.README: Added requirement to configure C++ + + * ACE-RTEMS.README: Added requirement to configure C++ support in RTEMS. Updated to reflect also compiling for mc68360 target. - + Wed Apr 11 20:36:36 2001 Nanbor Wang * examples/Synch/proc_sema.cpp (main): Fixd an assigning string diff --git a/tests/MEM_Stream_Test.cpp b/tests/MEM_Stream_Test.cpp index 0f74c116751..c893ee6504f 100644 --- a/tests/MEM_Stream_Test.cpp +++ b/tests/MEM_Stream_Test.cpp @@ -26,6 +26,7 @@ #include "ace/Connector.h" #include "ace/Acceptor.h" #include "ace/Svc_Handler.h" +#include "ace/Singleton.h" ACE_RCSID(tests, MEM_Stream_Test, "$Id$") @@ -40,12 +41,21 @@ static int opt_wfmo_reactor = 1; static int opt_select_reactor = 1; static ACE_MEM_IO::Signal_Strategy client_strategy = ACE_MEM_IO::Reactive; -ACE_Atomic_Op Echo_Handler::waiting_ = NO_OF_CONNECTION; -u_short Echo_Handler::connection_count_ = 0; +typedef ACE_Atomic_Op WaitingCounter; +typedef ACE_Singleton Waiting; + +// Number of connections that are currently open +static u_short connection_count = 0; typedef ACE_Acceptor ACCEPTOR; typedef ACE_Strategy_Acceptor S_ACCEPTOR; +static void reset_handler (void) +{ + (*Waiting::instance ()) = NO_OF_CONNECTION; + connection_count = 0; +} + int Echo_Handler::open (void *) { @@ -55,19 +65,12 @@ Echo_Handler::open (void *) Echo_Handler::Echo_Handler (ACE_Thread_Manager *thr_mgr) : ACE_Svc_Handler (thr_mgr), - connection_ (++Echo_Handler::connection_count_) + connection_ (++connection_count) { ACE_OS::sprintf (this->name_, ACE_TEXT ("Connection %d --> "), this->connection_); } -void -Echo_Handler::reset_handler (void) -{ - Echo_Handler::waiting_ = NO_OF_CONNECTION; - Echo_Handler::connection_count_ = 0; -} - int Echo_Handler::handle_input (ACE_HANDLE) { @@ -101,7 +104,7 @@ Echo_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask mask) { // Reduce count. - this->waiting_--; + (*Waiting::instance ())--; #if 1 if (client_strategy != ACE_MEM_IO::Reactive) @@ -110,7 +113,7 @@ Echo_Handler::handle_close (ACE_HANDLE, #endif /* tests */ // If no connections are open. - if (this->waiting_ == 0) + if ((*Waiting::instance ()) == 0) ACE_Reactor::instance ()->end_event_loop (); ACE_DEBUG ((LM_DEBUG, @@ -250,8 +253,6 @@ int test_multithreaded (ACE_MEM_Addr &server_addr) { ACE_DEBUG ((LM_DEBUG, "Testing Multithreaded MEM_Stream\n\n")); - Echo_Handler::reset_handler (); - client_strategy = ACE_MEM_IO::MT; ACE_Accept_Strategy accept_strategy; ACE_Creation_Strategy create_strategy; @@ -317,10 +318,14 @@ main (int, ACE_TCHAR *[]) unsigned short port = 0; ACE_MEM_Addr server_addr (port); + reset_handler (); + test_reactive (server_addr); ACE_Reactor::instance ()->reset_event_loop (); + reset_handler (); + test_multithreaded (server_addr); // Now testing @@ -333,6 +338,7 @@ main (int, ACE_TCHAR *[]) template class ACE_Svc_Handler ; template class ACE_Acceptor; template class ACE_Atomic_Op; +template class ACE_Singleton,ACE_Thread_Mutex>; template class ACE_Accept_Strategy; template class ACE_Creation_Strategy; template class ACE_Reactive_Strategy; @@ -344,6 +350,7 @@ template class ACE_Thread_Strategy; #pragma instantiate ACE_Svc_Handler #pragma instantiate ACE_Acceptor #pragma instantiate ACE_Atomic_Op +#pragma instantiate ACE_Singleton,ACE_Thread_Mutex> #pragma instantiate ACE_Accept_Strategy #pragma instantiate ACE_Creation_Strategy #pragma instantiate ACE_Reactive_Strategy diff --git a/tests/MEM_Stream_Test.h b/tests/MEM_Stream_Test.h index a681e9486dd..eb13586847d 100644 --- a/tests/MEM_Stream_Test.h +++ b/tests/MEM_Stream_Test.h @@ -46,13 +46,6 @@ public: // The Svc_Handler callbacks. virtual int svc (void); -public: - static ACE_Atomic_Op waiting_; - // How many connections are we waiting for. - - static u_short connection_count_; - // How many connections are currently open - private: ACE_TCHAR name_[MAXPATHLEN]; u_short connection_; -- cgit v1.2.1