summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-17 01:53:03 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-17 01:53:03 +0000
commitbe21b6b66af6024db5e13603f57e2bc870284b8d (patch)
treef6a068cb85a983100a04e6ae295792db5264842b /examples
parent6727290c3d209696c34ee296770f37a9695cbf54 (diff)
downloadATCD-be21b6b66af6024db5e13603f57e2bc870284b8d.tar.gz
Added better output prints.
Diffstat (limited to 'examples')
-rw-r--r--examples/Reactor/Proactor/test_timeout.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/examples/Reactor/Proactor/test_timeout.cpp b/examples/Reactor/Proactor/test_timeout.cpp
index 04d9b20d471..2835840a555 100644
--- a/examples/Reactor/Proactor/test_timeout.cpp
+++ b/examples/Reactor/Proactor/test_timeout.cpp
@@ -30,7 +30,8 @@ class Timeout_Handler : public ACE_Handler
// Generic timeout handler.
{
public:
- Timeout_Handler (void)
+ Timeout_Handler (void)
+ : start_time_ (ACE_OS::gettimeofday ())
{
}
@@ -41,13 +42,16 @@ public:
ACE_DEBUG ((LM_DEBUG, "(%t) %d timeout occurred for %s @ %d.\n",
++count_,
(char *) arg,
- tv.sec ()));
+ (tv - this->start_time_).sec ()));
// Sleep for a while
ACE_OS::sleep (4);
}
private:
ACE_Atomic_Op <ACE_Thread_Mutex, int> count_;
+
+ ACE_Time_Value start_time_;
+ // Starting time of the test.
};
class Worker : public ACE_Task <ACE_NULL_SYNCH>
@@ -75,17 +79,17 @@ main (int, char *[])
// Register a 2 second timer.
ACE_Time_Value foo_tv (2);
if (ACE_Proactor::instance ()->schedule_timer (handler,
- (void *) "Foo",
- ACE_Time_Value::zero,
- foo_tv) == -1)
+ (void *) "Foo",
+ ACE_Time_Value::zero,
+ foo_tv) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1);
// Register a 3 second timer.
ACE_Time_Value bar_tv (3);
if (ACE_Proactor::instance ()->schedule_timer (handler,
- (void *) "Bar",
- ACE_Time_Value::zero,
- bar_tv) == -1)
+ (void *) "Bar",
+ ACE_Time_Value::zero,
+ bar_tv) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1);
Worker worker;