summaryrefslogtreecommitdiff
path: root/examples/APG/Timers/Upcall.cpp
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2004-01-03 22:31:20 +0000
committerSteve Huston <shuston@riverace.com>2004-01-03 22:31:20 +0000
commit778bdea79f4d7941c6edfe96615d95434096d926 (patch)
treeb951fa8079191512d63ca7dffa74ac24aea4dfd8 /examples/APG/Timers/Upcall.cpp
parent628eb9ce5df12cb298cd4aea404eb389cc3b0a6c (diff)
downloadATCD-778bdea79f4d7941c6edfe96615d95434096d926.tar.gz
ChangeLogTag:Sat Jan 3 17:26:39 2004 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'examples/APG/Timers/Upcall.cpp')
-rw-r--r--examples/APG/Timers/Upcall.cpp107
1 files changed, 101 insertions, 6 deletions
diff --git a/examples/APG/Timers/Upcall.cpp b/examples/APG/Timers/Upcall.cpp
index 1a3294cf5a9..514838be1f4 100644
--- a/examples/APG/Timers/Upcall.cpp
+++ b/examples/APG/Timers/Upcall.cpp
@@ -5,19 +5,25 @@
#include "PTimerDispatcher.h"
// Listing 2 code/ch20
+// The signature of this method changed at ACE 5.4. The 'recurring_timer'
+// parameter was added.
int
-UpcallHandler::timeout (PTimerQueue &timer_queue,
+UpcallHandler::timeout (PTimerQueue &,
PCB *handler,
const void *arg,
- const ACE_Time_Value &cur_time)
+ int /* recurring_timer */,
+ const ACE_Time_Value &)
{
ACE_TRACE (ACE_TEXT ("UpcallHandler::timeout"));
return (*handler).handleEvent (arg);
}
+#if 0
+// This method was removed at ACE 5.4. Replaced by cancel_type() and
+// cancel_timer().
int
-UpcallHandler::cancellation (PTimerQueue &timer_queue,
+UpcallHandler::cancellation (PTimerQueue &,
PCB *handler)
{
ACE_TRACE (ACE_TEXT ("UpcallHandler::cancellation"));
@@ -28,12 +34,13 @@ UpcallHandler::cancellation (PTimerQueue &timer_queue,
return handler->handleCancel ();
}
+#endif /* 0 */
// This method is called when the timer is canceled
int
-UpcallHandler::deletion (PTimerQueue &timer_queue,
- PCB *handler,
- const void *arg)
+UpcallHandler::deletion (PTimerQueue &,
+ PCB *handler,
+ const void *)
{
ACE_TRACE (ACE_TEXT ("UpcallHandler::deletion"));
@@ -45,6 +52,94 @@ UpcallHandler::deletion (PTimerQueue &timer_queue,
}
// Listing 2
+// *** The rest of the UpcallHandler methods were added for ACE 5.4 ***
+
+// This method is called when a timer is registered.
+int
+UpcallHandler::registration (PTimerQueue &,
+ PCB *handler,
+ const void *)
+{
+ ACE_TRACE (ACE_TEXT ("UpcallHandler::registration"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Handler %d has been registered.\n"),
+ handler->getID ()));
+ return 0;
+}
+
+// This method is called at expiration time, before the actual upcall
+// to the handler is made. ACE uses this to adjust reference counts
+// when needed.
+int
+UpcallHandler::preinvoke (PTimerQueue &,
+ PCB *handler,
+ const void *,
+ int,
+ const ACE_Time_Value &,
+ const void *&)
+{
+ ACE_TRACE (ACE_TEXT ("UpcallHandler::preinvoke"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Handler %d is about to upcalled.\n"),
+ handler->getID ()));
+ return 0;
+}
+
+// This method is called at expiration time, after the actual upcall
+// to the handler returns. ACE uses this to adjust reference counts
+// when needed.
+int
+UpcallHandler::postinvoke (PTimerQueue &,
+ PCB *handler,
+ const void *,
+ int,
+ const ACE_Time_Value &,
+ const void *)
+{
+ ACE_TRACE (ACE_TEXT ("UpcallHandler::postinvoke"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Handler %d returned from upcall.\n"),
+ handler->getID ()));
+ return 0;
+}
+
+// This method is called when a handler is cancelled
+int
+UpcallHandler::cancel_type (PTimerQueue &,
+ PCB *handler,
+ int dont_call,
+ int &)
+{
+ ACE_TRACE (ACE_TEXT ("UpcallHandler::cancel_type"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Handler %d has been cancelled\n"),
+ handler->getID ()));
+ if (!dont_call)
+ return handler->handleCancel ();
+ return 0;
+}
+
+// This method is called when a timer is cancelled
+int
+UpcallHandler::cancel_timer (PTimerQueue &,
+ PCB *handler,
+ int dont_call,
+ int)
+{
+ ACE_TRACE (ACE_TEXT ("UpcallHandler::cancel_timer"));
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("Handler %d has been cancelled\n"),
+ handler->getID ()));
+ if (!dont_call)
+ return handler->handleCancel ();
+ return 0;
+}
+
// Listing 3 code/ch20
int ACE_TMAIN (int, ACE_TCHAR *[])