summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-12 21:47:04 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-10-12 21:47:04 +0000
commita033a40ff39c2172b517fa6413ea4902f6cd20c2 (patch)
treed93c790742519ecdce61353423fb977de0b46233 /examples
parent4b481a20d9d696d71b31fa67bca25e0f4debee66 (diff)
downloadATCD-a033a40ff39c2172b517fa6413ea4902f6cd20c2.tar.gz
ChangeLogTag:Sun Oct 12 16:45:47 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'examples')
-rw-r--r--examples/Timer_Queue/Thread_Timer_Queue_Test.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp b/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp
index 99074c41ad0..d687c52fb46 100644
--- a/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp
+++ b/examples/Timer_Queue/Thread_Timer_Queue_Test.cpp
@@ -60,7 +60,8 @@ public:
private:
ACE_Time_Value expires_;
- // @@ Please add comments.
+ // Store the expected time of expiration, it is used to print a nice
+ // message saying how much delay was at the actual expiration time.
int id_;
// Store an "id" for the Handler, which is only use to print better
@@ -82,20 +83,30 @@ public:
// The method run on the new thread.
private:
- // Some helper methods.
- // @@ Please add comments.
+ // = Some helper methods.
void usage (void) const;
+ // Print a "Usage" message to the user.
+
int add_timer (u_long seconds);
+ // Add a new timer to expire in <seconds> more.
+
void cancel_timer (int id);
+ // Cancel timer <id>.
+
int parse_commands (const char *buffer);
+ // Parse the commands in <buffer>, it is expected to be a line of
+ // input from the user.
+
void dump (void);
+ // Dump the state of the timer queue.
private:
- // @@ Please add comments.
Thread_Timer_Queue *queue_;
+ // The timer queue implementation.
const int usecs_;
+ // How many micro seconds are in a second.
};
// Administrivia methods...
@@ -307,10 +318,28 @@ main (int argc, char* argv[])
return 0;
}
-// @@ Add template specializations.
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Thread_Timer_Queue_Adapter<Timer_Heap>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Thread_Timer_Queue_Adapter<Timer_Heap>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+#if !defined(ACE_MT_SAFE)
+
+// These templates will specialized in liACE.* if the platforms does
+// not define ACE_MT_SAFE.
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>;
+template class ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>;
+template class ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>;
+
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>
+#pragma instantiate ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>
+#pragma instantiate ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+#endif /* ACE_MT_SAFE */