diff options
Diffstat (limited to 'docs/tutorials/Chap_5/ex03.html')
-rw-r--r-- | docs/tutorials/Chap_5/ex03.html | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/docs/tutorials/Chap_5/ex03.html b/docs/tutorials/Chap_5/ex03.html deleted file mode 100644 index 07dabd17a97..00000000000 --- a/docs/tutorials/Chap_5/ex03.html +++ /dev/null @@ -1,86 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Ambreen Ilyas"> - <META NAME="GENERATOR" CONTENT="Mozilla/4.05 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]"> - <TITLE>Example 3</TITLE> -</HEAD> -<BODY> -<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> -<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers -Guide.</FONT> -<BR><FONT COLOR="#CC0000">//// Chapter: "The Reactor" (Event -Management)</FONT> -<BR><FONT COLOR="#CC0000">//// For details please see the guide at</FONT> -<BR><FONT COLOR="#CC0000">//// http://www.cs.wustl.edu/~schmidt/ACE.html</FONT> -<BR><FONT COLOR="#CC0000">//// AUTHOR: Umar Syyid (usyyid@hns.com)</FONT> -<BR><FONT COLOR="#CC0000">//// and Ambreen Ilyas (ambreen@bitsmart.com)</FONT> -<BR><FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT> - -<P><FONT COLOR="#FF0000">//Example 3</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/Timer_Queue.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> "<FONT COLOR="#006600">ace/Reactor.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">NUMBER_TIMERS -10</FONT> - -<P>static int done = 0; -<BR>static int count = 0; - -<P>class Time_Handler : public ACE_Event_Handler -<BR>{ -<BR>public: -<BR> <FONT COLOR="#FF0000">//Method which is called back by the Reactor -when timeout occurs.</FONT> -<BR> virtual int handle_timeout (const ACE_Time_Value &tv, -<BR> const void *arg){ -<BR> long current_count = long (arg); -<BR> ACE_ASSERT (current_count == count); -<BR> ACE_DEBUG ((LM_DEBUG, "%d: Timer #%d timed out at %d!\n", -<BR> count, current_count, tv.sec())); -<BR> - -<P><FONT COLOR="#FF0000">//Increment count</FONT> -<BR> count ++; - -<P><FONT COLOR="#FF0000">//Make sure assertion doesnt fail for missing -5th timer.</FONT> -<BR> if (count ==5) -<BR> count++; -<BR> -<BR><FONT COLOR="#FF0000"> //If all timers done then set done flag</FONT> -<BR> if (current_count == NUMBER_TIMERS - 1) -<BR> done = 1; -<BR><FONT COLOR="#FF0000"> //Keep yourself registered with the Reactor.</FONT> -<BR> return 0; -<BR> } -<BR>}; - -<P>int -<BR>main (int, char *[]) -<BR>{ -<BR> ACE_Reactor reactor; -<BR> Time_Handler *th=new Time_Handler; -<BR> int timer_id[NUMBER_TIMERS]; -<BR> int i; - -<P> for (i = 0; i < NUMBER_TIMERS; i++) -<BR> timer_id[i] = reactor.schedule_timer (th, -<BR> (const void *) i, <FONT COLOR="#FF0000">// argument sent -to handle_timeout()</FONT> -<BR> ACE_Time_Value (2 * i + 1));<FONT COLOR="#FF0000"> //set -timer to go off with delay</FONT> - -<P><FONT COLOR="#CC0000"> //Cancel the fifth timer before it goes -off</FONT> -<BR> reactor.cancel_timer(timer_id[5]);<FONT COLOR="#FF0000">//Timer -ID of timer to be removed</FONT> - -<P> while (!done) -<BR> reactor.handle_events (); - -<P> return 0; -<BR>} - -<P> <A HREF="ex04.html">Next Example</A> -</BODY> -</HTML> |