summaryrefslogtreecommitdiff
path: root/tests/Timer_Queue_Test.cpp
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-06-23 14:46:38 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-06-23 14:46:38 +0000
commit3858ad6c72381b97589ae046e563a95332a4a632 (patch)
tree3706996e45825dee4805b3d385967d978eea7178 /tests/Timer_Queue_Test.cpp
parent735a987b53a6b8a8b2ad0f22ae178e3dadefacd3 (diff)
downloadATCD-3858ad6c72381b97589ae046e563a95332a4a632.tar.gz
Added testing for cancellation during expire (when of handle_timeout() in
an event handler returning -1)
Diffstat (limited to 'tests/Timer_Queue_Test.cpp')
-rw-r--r--tests/Timer_Queue_Test.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/Timer_Queue_Test.cpp b/tests/Timer_Queue_Test.cpp
index 9f0ed880dcf..2fb22cd88d0 100644
--- a/tests/Timer_Queue_Test.cpp
+++ b/tests/Timer_Queue_Test.cpp
@@ -101,6 +101,23 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_ASSERT (tq->expire () == 2);
+ ACE_ASSERT (tq->schedule (&eh, (const void *) 007,
+ tq->gettimeofday ()) != -1);
+ ACE_ASSERT (tq->schedule (&eh, (const void *) 42,
+ tq->gettimeofday () + ACE_Time_Value (100)) != -1);
+ ACE_ASSERT (tq->schedule (&eh, (const void *) 42,
+ tq->gettimeofday () + ACE_Time_Value (100)) != -1);
+
+ // The following will trigger a call to <handle_close> when
+ // it cancels the second timer. This happens because the first
+ // timer has an <act> of 007, which causes eh.handle_timeout () to
+ // return -1. Since -1 is returned, all timers that use <eh> will
+ // be cancelled (and <handle_close> will only be called on the first
+ // timer that is cancelled).
+ ACE_ASSERT (tq->expire () == 1);
+ ACE_ASSERT (tq->is_empty () != 0);
+
+
ACE_ASSERT (tq->schedule (&eh, (const void *) 4,
tq->gettimeofday ()) != -1);
ACE_ASSERT (tq->schedule (&eh, (const void *) 5,
@@ -124,7 +141,7 @@ test_functionality (ACE_Timer_Queue *tq)
ACE_ASSERT (tq->cancel (timer_id) == 1);
ACE_ASSERT (tq->cancel (&eh) == 1);
ACE_ASSERT (tq->expire () == 0);
- ACE_ASSERT (eh.close_count_ == 2);
+ ACE_ASSERT (eh.close_count_ == 3);
}
static void