diff options
author | bala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-07-25 02:34:56 +0000 |
---|---|---|
committer | bala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-07-25 02:34:56 +0000 |
commit | b9fd3b8e5f466dfbd2d51b8e11f696d260dbfb09 (patch) | |
tree | 0c269c603d163fc06b338849fb48abe0abd1a03a /TAO/tests/Stack_Recursion | |
parent | 191d46ad72017df2a8aa0b6d800de8f5b7a417a2 (diff) | |
download | ATCD-b9fd3b8e5f466dfbd2d51b8e11f696d260dbfb09.tar.gz |
ChangeLogTag:Mon Jul 22 17:26:14 2002 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tests/Stack_Recursion')
-rw-r--r-- | TAO/tests/Stack_Recursion/Sender.cpp | 27 | ||||
-rw-r--r-- | TAO/tests/Stack_Recursion/Sender.h | 11 | ||||
-rw-r--r-- | TAO/tests/Stack_Recursion/Server_Task.cpp | 15 | ||||
-rw-r--r-- | TAO/tests/Stack_Recursion/Server_Task.h | 6 | ||||
-rw-r--r-- | TAO/tests/Stack_Recursion/Test.idl | 3 | ||||
-rw-r--r-- | TAO/tests/Stack_Recursion/client.cpp | 6 | ||||
-rwxr-xr-x | TAO/tests/Stack_Recursion/run_test.pl | 4 | ||||
-rw-r--r-- | TAO/tests/Stack_Recursion/server.cpp | 3 |
8 files changed, 65 insertions, 10 deletions
diff --git a/TAO/tests/Stack_Recursion/Sender.cpp b/TAO/tests/Stack_Recursion/Sender.cpp index f48b090af9e..75a2b795143 100644 --- a/TAO/tests/Stack_Recursion/Sender.cpp +++ b/TAO/tests/Stack_Recursion/Sender.cpp @@ -7,14 +7,16 @@ ACE_RCSID(Stack_Recursion, Sender, "$Id$") -Sender::Sender (void) +Sender::Sender (CORBA::ORB_ptr orb) : message_count_ (0) , byte_count_ (0) + , orb_ (CORBA::ORB::_duplicate (orb)) + , is_done_ (0) { } void -Sender::dump_results () +Sender::dump_results (void) { ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_); ACE_DEBUG ((LM_DEBUG, @@ -24,6 +26,12 @@ Sender::dump_results () this->byte_count_)); } +int +Sender::is_done (void) const +{ + return this->is_done_; +} + CORBA::Boolean Sender::get_data (CORBA::ULong size, Test::Payload_out payload @@ -62,3 +70,18 @@ Sender::ping (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { return; } + +void +Sender::shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (this->is_done_ == 0) + { + ACE_GUARD (ACE_SYNCH_MUTEX, + ace_mon, + this->mutex_); + + if (this->is_done_ == 0) + this->is_done_ = 1; + } +} diff --git a/TAO/tests/Stack_Recursion/Sender.h b/TAO/tests/Stack_Recursion/Sender.h index 56a4ac8d122..4472d181d37 100644 --- a/TAO/tests/Stack_Recursion/Sender.h +++ b/TAO/tests/Stack_Recursion/Sender.h @@ -25,11 +25,14 @@ class Sender { public: /// Constructor - Sender (void); + Sender (CORBA::ORB_ptr orb); /// Print out the results void dump_results (void); + /// Get the status of the flag.. + int is_done (void) const; + // = The skeleton methods virtual CORBA::Boolean get_data (CORBA::ULong size, Test::Payload_out payload @@ -42,10 +45,16 @@ public: virtual void ping (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + private: ACE_SYNCH_MUTEX mutex_; CORBA::ULong message_count_; CORBA::ULong byte_count_; + CORBA::ORB_var orb_; + + int is_done_; }; #if defined(_MSC_VER) && (_MSC_VER >= 1200) diff --git a/TAO/tests/Stack_Recursion/Server_Task.cpp b/TAO/tests/Stack_Recursion/Server_Task.cpp index d331cd5377d..573aa5de358 100644 --- a/TAO/tests/Stack_Recursion/Server_Task.cpp +++ b/TAO/tests/Stack_Recursion/Server_Task.cpp @@ -3,15 +3,18 @@ // #include "Server_Task.h" +#include "Sender.h" ACE_RCSID(Stack_Recusrion, Server_Task, "$Id$") Server_Task::Server_Task (CORBA::ORB_ptr orb, + const Sender *sender, ACE_Thread_Manager *thr_mgr) : ACE_Task_Base (thr_mgr) , orb_ (CORBA::ORB::_duplicate (orb)) + , sender_ (sender) { } @@ -22,10 +25,14 @@ Server_Task::svc (void) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - // run the test for at most 120 seconds... - ACE_Time_Value tv (120, 0); - this->orb_->run (tv ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + while (!this->sender_->is_done ()) + { + // run the test for at most 120 seconds... + ACE_Time_Value tv (240, 0); + this->orb_->run (tv ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + } ACE_CATCHANY { diff --git a/TAO/tests/Stack_Recursion/Server_Task.h b/TAO/tests/Stack_Recursion/Server_Task.h index 9b76b615967..6d5b47f936c 100644 --- a/TAO/tests/Stack_Recursion/Server_Task.h +++ b/TAO/tests/Stack_Recursion/Server_Task.h @@ -13,12 +13,15 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" +class Sender; + /// Implement a Task to run the experiments using multiple threads. class Server_Task : public ACE_Task_Base { public: /// Constructor Server_Task (CORBA::ORB_ptr orb, + const Sender *ptr, ACE_Thread_Manager *thr_mgr); /// Thread entry point @@ -27,6 +30,9 @@ public: private: /// Reference to the ORB CORBA::ORB_var orb_; + + /// The sender pointer + const Sender *sender_; }; #include "ace/post.h" diff --git a/TAO/tests/Stack_Recursion/Test.idl b/TAO/tests/Stack_Recursion/Test.idl index 520fe4111bf..91adb6e4bf6 100644 --- a/TAO/tests/Stack_Recursion/Test.idl +++ b/TAO/tests/Stack_Recursion/Test.idl @@ -17,5 +17,8 @@ module Test /// Simple ping to the server void ping (); + + /// A method to shutdown the ORB + oneway void shutdown (); }; }; diff --git a/TAO/tests/Stack_Recursion/client.cpp b/TAO/tests/Stack_Recursion/client.cpp index dec14e14636..b9db252871c 100644 --- a/TAO/tests/Stack_Recursion/client.cpp +++ b/TAO/tests/Stack_Recursion/client.cpp @@ -81,6 +81,12 @@ main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "(%P) - Receiver got %d messages\n", count)); + // shutdown the remote ORB + sender->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + + orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } diff --git a/TAO/tests/Stack_Recursion/run_test.pl b/TAO/tests/Stack_Recursion/run_test.pl index 6fd3f60728a..e35136b50e0 100755 --- a/TAO/tests/Stack_Recursion/run_test.pl +++ b/TAO/tests/Stack_Recursion/run_test.pl @@ -27,7 +27,7 @@ if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) { $CL->Spawn (60); -$client = $CL->WaitKill (120); +$client = $CL->WaitKill (480); if ($client != 0) { print STDERR "ERROR: client returned $client1\n"; @@ -42,7 +42,7 @@ if ($server != 0) { } @files= <core.*>; -unlink (@files); +#unlink (@files); unlink $iorfile; exit $status; diff --git a/TAO/tests/Stack_Recursion/server.cpp b/TAO/tests/Stack_Recursion/server.cpp index 0b7d02dd3da..03dc154d085 100644 --- a/TAO/tests/Stack_Recursion/server.cpp +++ b/TAO/tests/Stack_Recursion/server.cpp @@ -66,7 +66,7 @@ main (int argc, char *argv[]) Sender *sender_impl; ACE_NEW_RETURN (sender_impl, - Sender, + Sender (orb.in ()), 1); PortableServer::ServantBase_var receiver_owner_transfer(sender_impl); @@ -93,6 +93,7 @@ main (int argc, char *argv[]) ACE_TRY_CHECK; Server_Task server_task (orb.in (), + sender_impl, ACE_Thread_Manager::instance ()); if (server_task.activate (THR_NEW_LWP | THR_JOINABLE, 4, 1) == -1) |