diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-15 23:42:55 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-15 23:42:55 +0000 |
commit | ccf3436e4c9bb3793e98615ef7aca486105199ad (patch) | |
tree | 46dda5f846159f4558d56afdd5a1798f41a6d710 /TAO/tests | |
parent | 290d04ca8cd675fa65c87878e42a32f769a73fb6 (diff) | |
download | ATCD-ccf3436e4c9bb3793e98615ef7aca486105199ad.tar.gz |
ChangeLogTag: Mon May 15 18:19:53 2000 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Leader_Followers/client.cpp | 21 | ||||
-rwxr-xr-x | TAO/tests/Leader_Followers/run_test.pl | 2 |
2 files changed, 15 insertions, 8 deletions
diff --git a/TAO/tests/Leader_Followers/client.cpp b/TAO/tests/Leader_Followers/client.cpp index c2f08ac8f79..b62ef54ff23 100644 --- a/TAO/tests/Leader_Followers/client.cpp +++ b/TAO/tests/Leader_Followers/client.cpp @@ -20,8 +20,8 @@ ACE_RCSID(Leader_Followers, client, "$Id$") -// Name of file contains ior. -static const char *IOR = "file://ior"; + // Name of file contains ior. + static const char *IOR = "file://ior"; // Number of client threads. static int number_of_client_threads = 5; @@ -100,7 +100,8 @@ class Client_Task : public ACE_Task_Base public: Client_Task (test_ptr t) : test_ (test::_duplicate (t)), - work_so_far_ (0) + work_so_far_ (0), + sleep_ (0) { } @@ -111,15 +112,21 @@ public: ACE_TRY { u_long work_from_this_thread = 0; + ACE_Time_Value sleep_for_this_thread; { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); this->work_so_far_ += remote_work / number_of_client_threads; - work_from_this_thread = this->work_so_far_; + + sleep_for_this_thread.msec (this->sleep_); + this->sleep_ += 1000 / number_of_client_threads; } + // Small pause to avoid overrunning the server. + ACE_OS::sleep (sleep_for_this_thread); + // Invoke the method. ACE_DEBUG ((LM_DEBUG, "Client: Invoking server from thread %t for time %d @ %T\n", @@ -160,6 +167,9 @@ private: ACE_SYNCH_MUTEX lock_; // Lock for work counter. + + u_long sleep_; + // Small pause to avoid overrunning the server. }; class Event_Loop_Task : public ACE_Task_Base @@ -183,7 +193,6 @@ public: ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, -1); this->event_loop_timeout_so_far_ += event_loop_timeout / number_of_event_loop_threads; - event_loop_timeout_for_this_thread = this->event_loop_timeout_so_far_; } @@ -287,7 +296,7 @@ main (int argc, char **argv) Event_Loop_Task event_loop_task (orb.in ()); if (event_loop_task.activate (THR_NEW_LWP | THR_JOINABLE, - number_of_event_loop_threads) != 0) + number_of_event_loop_threads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate event_loop threads\n"), -1); diff --git a/TAO/tests/Leader_Followers/run_test.pl b/TAO/tests/Leader_Followers/run_test.pl index 03b66560be8..b7bcc9a19f0 100755 --- a/TAO/tests/Leader_Followers/run_test.pl +++ b/TAO/tests/Leader_Followers/run_test.pl @@ -86,7 +86,6 @@ sub run_clients unlink $iorfile; -if (0) { print STDERR "\n\n*** Single threaded server ***\n\n\n"; $SV = Process::Create ($EXEPREFIX."server$EXE_EXT", "-o $iorfile"); @@ -112,7 +111,6 @@ if ($server != 0 || $client != 0) { print STDERR "ERROR: server exit value = $server and client exit value = $client\n"; exit 1; } -} print STDERR "\n\n*** Thread-Pool server ***\n\n\n"; |