diff options
Diffstat (limited to 'docs/tutorials/014/page02.html')
-rw-r--r-- | docs/tutorials/014/page02.html | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/docs/tutorials/014/page02.html b/docs/tutorials/014/page02.html deleted file mode 100644 index 452f18f49df..00000000000 --- a/docs/tutorials/014/page02.html +++ /dev/null @@ -1,92 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="Bob McWhirter"> - <TITLE>ACE Tutorial 014</TITLE> -</HEAD> -<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> - -<CENTER><B><FONT SIZE=+2>ACE Tutorial 014</FONT></B></CENTER> - -<CENTER><B><FONT SIZE=+2>ACE_Stream Tutorial, Of Sorts</FONT></B></CENTER> - -<P> -<HR WIDTH="100%"> -<P> -You find pretty soon that anytime you work with ACE_Task<> you - have to create a derivative. The Task.h header simply provides - that derivative with the overrides we'll need in our application. -<P> -<HR WIDTH="100%"> -<PRE> - -<font color=red>// $Id$</font> - -<font color=red>// Task.h</font> -<font color=red>//</font> -<font color=red>// Tutorial regarding a way to use ACE_Stream.</font> -<font color=red>//</font> -<font color=red>// written by bob mcwhirter (bob@netwrench.com)</font> -<font color=red>//</font> -<font color=red>//</font> - -<font color=blue>#ifndef</font> <font color=purple>TASK_H</font> -<font color=blue>#define</font> <font color=purple>TASK_H</font> - -<font color=blue>#include</font> <ace/Task.h> -<font color=blue>#include</font> <ace/Synch.h> - -<font color=red>// Always typedef when possible.</font> - -typedef ACE_Task<ACE_MT_SYNCH> Task_Base; - -class Task : public Task_Base -{ - -public: - - typedef Task_Base inherited; - <font color=red>// This is just good form.</font> - - Task(const char *nameOfTask, - int numberOfThreads); - <font color=red>// Initialize our Task with a name,</font> - <font color=red>// and number of threads to spawn.</font> - - virtual ~Task(void); - - virtual int open(void *arg); - <font color=red>// This is provided to prevent compiler complaints</font> - <font color=red>// about hidden virtual functions.</font> - - virtual int close(u_long flags); - <font color=red>// This closes down the Task and all service threads.</font> - - virtual int put(ACE_Message_Block *message, - ACE_Time_Value *timeout); - <font color=red>// This is the interface that ACE_Stream uses to</font> - <font color=red>// communicate with our Task.</font> - - virtual int svc(void); - <font color=red>// This is the actual service loop each of the service</font> - <font color=red>// threads iterates through.</font> - - const char *nameOfTask(void) const; - <font color=red>// Returns the name of this Task.</font> - -private: - - int d_numberOfThreads; - char d_nameOfTask[64]; - - ACE_Barrier d_barrier; - <font color=red>// Simple Barrier to make sure all of our service</font> - <font color=red>// threads have entered their loop before accepting</font> - <font color=red>// any messages.</font> -}; - - -<font color=blue>#endif</font> <font color=red>// TASK_H</font> -</PRE> -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page03.html">Continue This Tutorial</A>]</CENTER> |