summaryrefslogtreecommitdiff
path: root/examples/APG/Timers/Task.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/APG/Timers/Task.cpp')
-rw-r--r--examples/APG/Timers/Task.cpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/examples/APG/Timers/Task.cpp b/examples/APG/Timers/Task.cpp
deleted file mode 100644
index d25a8197857..00000000000
--- a/examples/APG/Timers/Task.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// $Id$
-
-#include "ace/OS_NS_sys_time.h"
-
-// Listing 1 code/ch20
-#include "ace/Timer_Queue_Adapters.h"
-#include "ace/Timer_Heap.h"
-
-typedef ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Heap>
- ActiveTimer;
-
-// Listing 1
-// Listing 2 code/ch20
-class CB : public ACE_Event_Handler
-{
-public:
- CB (int id) : id_(id) { }
-
- virtual int handle_timeout (const ACE_Time_Value &,
- const void *arg)
- {
- ACE_TRACE (ACE_TEXT ("CB::handle_timeout"));
-
- const int *val = ACE_static_cast (const int*, arg);
- ACE_ASSERT((*val) == id_);
-
- ACE_UNUSED_ARG (val);
-
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Expiry handled by thread %t\n")));
- return 0;
- }
-
-private:
- int id_;
-};
-// Listing 2
-
-// Listing 3 code/ch20
-int ACE_TMAIN (int, ACE_TCHAR *[])
-{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("the main thread %t has started \n")));
-
- // Create an "active" timer and start its thread.
- ActiveTimer atimer;
- atimer.activate ();
-
- CB cb1 (1);
- CB cb2 (2);
- int arg1 = 1;
- int arg2 = 2;
-
- // Schedule timers to go off 3 & 4 seconds from now
- // and then with an interval of 1.1 seconds.
- const ACE_Time_Value curr_tv = ACE_OS::gettimeofday ();
- ACE_Time_Value interval = ACE_Time_Value (1, 100000);
-
- atimer.schedule (&cb1,
- &arg1,
- curr_tv + ACE_Time_Value (3L),
- interval);
- atimer.schedule (&cb2,
- &arg2,
- curr_tv + ACE_Time_Value (4L),
- interval);
-
- ACE_Thread_Manager::instance ()->wait (); // Wait forever.
-
- return 0;
-}
-// Listing 3
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Heap>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Thread_Timer_Queue_Adapter<ACE_Timer_Heap>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION*/