diff options
Diffstat (limited to 'docs/tutorials/Chap_5/ex04.html')
-rw-r--r-- | docs/tutorials/Chap_5/ex04.html | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/docs/tutorials/Chap_5/ex04.html b/docs/tutorials/Chap_5/ex04.html deleted file mode 100644 index 95971be40b3..00000000000 --- a/docs/tutorials/Chap_5/ex04.html +++ /dev/null @@ -1,85 +0,0 @@ -<HTML> -<!-- $Id$ --> -<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 4</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 4</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Reactor.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Event_Handler.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Synch_T.h"</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Thread_Manager.h"</FONT> -<BR><FONT COLOR="#000099">#define</FONT> <FONT COLOR="#663366">WAIT_TIME -1</FONT> -<BR><FONT COLOR="#000099">#define</FONT><FONT COLOR="#663366"> SLEEP_TIME -2</FONT> - -<P>class My_Handler: public ACE_Event_Handler{ -<BR> public: - -<P><FONT COLOR="#FF0000"> //Start the event handling process.</FONT> -<BR> My_Handler(){ -<BR> ACE_DEBUG((LM_DEBUG,"Event Handler created\n")); -<BR> ACE_Reactor::instance()->max_notify_iterations(5); -<BR> return 0; -<BR> } - -<P><FONT COLOR="#FF0000">//Perform the notifications i.e., notify the reactor -10 times</FONT> -<BR> void perform_notifications(){ -<BR> for(int i=0;i<10;i++) -<BR> ACE_Reactor::instance()-> -<BR> notify(this,ACE_Event_Handler::READ_MASK); -<BR> } -<BR> -<BR><FONT COLOR="#FF0000"> //The actual handler which in this case -will handle the notifications</FONT> -<BR> int handle_input(int){ -<BR> ACE_DEBUG((LM_DEBUG,"Got notification # %d\n",no)); -<BR> no++; -<BR> return 0; -<BR> } -<BR>private: -<BR> static int no; -<BR>}; - -<P><FONT COLOR="#FF0000">//Static members</FONT> -<BR>int My_Handler::no=1; -<BR> - -<P>int main(int argc, char *argv[]){ -<BR><FONT COLOR="#FF0000"> //Instantiating the handler</FONT> -<BR> My_Handler handler; -<BR> -<BR><FONT COLOR="#FF0000"> //The done flag is set to not done yet.</FONT> -<BR> int done=0; - -<P>while(1){ -<BR> <FONT COLOR="#FF0000"> //After WAIT_TIME the handle_events will -fall through if no events arrive.</FONT> -<BR> ACE_Reactor::instance()->handle_events(ACE_Time_Value(WAIT_TIME)); -<BR> if(!done){ -<BR> handler.perform_notifications(); -<BR> done=1; -<BR> } -<BR> sleep(SLEEP_TIME); -<BR> } -<BR>} - -<P> <A HREF="ex05.html">Next Example</A> -</BODY> -</HTML> |