diff options
Diffstat (limited to 'docs/tutorials/Chap_5/ex01.html')
-rw-r--r-- | docs/tutorials/Chap_5/ex01.html | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/docs/tutorials/Chap_5/ex01.html b/docs/tutorials/Chap_5/ex01.html deleted file mode 100644 index 54bb3204b61..00000000000 --- a/docs/tutorials/Chap_5/ex01.html +++ /dev/null @@ -1,75 +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 1</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 1</FONT> -<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600"><signal.h></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> - -<P><FONT COLOR="#FF0000">//Create our subclass to handle the signal events</FONT> -<BR><FONT COLOR="#FF0000">//that we wish to handle. Since we know that -this particular</FONT> -<BR><FONT COLOR="#FF0000">//event handler is going to be using signals -we only overload the</FONT> -<BR><FONT COLOR="#FF0000">//handle_signal method.</FONT> - -<P>class -<BR>MyEventHandler: public ACE_Event_Handler{ -<BR>int -<BR>handle_signal(int signum, siginfo_t*,ucontext_t*){ -<BR> switch(signum){ -<BR> case SIGWINCH: -<BR> ACE_DEBUG((LM_DEBUG, "You pressed SIGWINCH \n")); -<BR> break; - -<P> case SIGINT: -<BR> ACE_DEBUG((LM_DEBUG, "You pressed SIGINT \n")); -<BR> break; -<BR> } -<BR> return 0; -<BR> } -<BR>}; - -<P>int main(int argc, char *argv[]){ -<BR><FONT COLOR="#FF0000"> //instantiate the handler</FONT> -<BR> MyEventHandler *eh =new MyEventHandler; - -<P><FONT COLOR="#FF0000">//Register the handler asking to call back when -either SIGWINCH</FONT> -<BR><FONT COLOR="#FF0000">//or SIGINT signals occur. Note that in both -the cases we asked the</FONT> -<BR><FONT COLOR="#FF0000">//Reactor to call back the same Event_Handler -i.e., MyEventHandler.</FONT> -<BR><FONT COLOR="#FF0000">//This is the reason why we had to write a switch -statement in the handle_signal()</FONT> -<BR><FONT COLOR="#FF0000">//method above. Also note that the</FONT> -<BR><FONT COLOR="#FF0000">//ACE_Reactor is being used as a Singleton object -(Singleton pattern)</FONT> - -<P> ACE_Reactor::instance()->register_handler(SIGWINCH,eh); -<BR> ACE_Reactor::instance()->register_handler(SIGINT,eh); -<BR> while(1) -<BR> <FONT COLOR="#FF0000"> //Start the reactors event loop</FONT> -<BR> ACE_Reactor::instance()->handle_events(); -<BR>} - -<P> <A HREF="ex02.html">Next Example</A> -<BR> -</BODY> -</HTML> |