summaryrefslogtreecommitdiff
path: root/docs/tutorials/Chap_3
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-09-23 19:31:01 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-09-23 19:31:01 +0000
commit08d2cf8ae623f5aa87ad12ff30ad4ea9e40c8956 (patch)
tree7cadcc4a888a92984e1d9c9f98ae22367e360838 /docs/tutorials/Chap_3
parentcaff940a39e93bc503c3a18ef4daf9aa0a85172b (diff)
downloadATCD-pre_avsvc_split.tar.gz
This commit was manufactured by cvs2svn to create tagpre_avsvc_split
'pre_avsvc_split'.
Diffstat (limited to 'docs/tutorials/Chap_3')
-rw-r--r--docs/tutorials/Chap_3/Chap_3.zipbin3004 -> 0 bytes
-rw-r--r--docs/tutorials/Chap_3/Makefile29
-rw-r--r--docs/tutorials/Chap_3/README14
-rw-r--r--docs/tutorials/Chap_3/ex01.html107
-rw-r--r--docs/tutorials/Chap_3/ex02.html135
-rw-r--r--docs/tutorials/Chap_3/ex03.html115
-rw-r--r--docs/tutorials/Chap_3/mm.cpp113
7 files changed, 0 insertions, 513 deletions
diff --git a/docs/tutorials/Chap_3/Chap_3.zip b/docs/tutorials/Chap_3/Chap_3.zip
deleted file mode 100644
index c99463d18d9..00000000000
--- a/docs/tutorials/Chap_3/Chap_3.zip
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/Chap_3/Makefile b/docs/tutorials/Chap_3/Makefile
deleted file mode 100644
index e3f1f3ae1c8..00000000000
--- a/docs/tutorials/Chap_3/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#----------------------------------------------------------------------------
-#
-# $Id$
-#
-# Makefile for all the ACE ``one-button' tests
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# Local macros
-#----------------------------------------------------------------------------
-
-BIN = mm
-
-PSRC=$(addsuffix .cpp,$(BIN))
-
-#----------------------------------------------------------------------------
-# Include macros and targets
-#----------------------------------------------------------------------------
-
-include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
-include $(ACE_ROOT)/include/makeinclude/macros.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
-
-include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
-
-ex03.html : mm.cpp
- ../colorize < mm.cpp > ex03.html
diff --git a/docs/tutorials/Chap_3/README b/docs/tutorials/Chap_3/README
deleted file mode 100644
index 228579ca4c5..00000000000
--- a/docs/tutorials/Chap_3/README
+++ /dev/null
@@ -1,14 +0,0 @@
-Note:
-
-Example 2 (ex02.html) will not compile and work on Win32 because
-it relies on SystemV Shared Memory and fork() which are not
-available on that platoform.
-
-Example 3 (ex03.html) is basically the same but uses a memory-mapped
-file instead of SYSV Shared Memory. It also takes a single command
-line parament 's' to start it in server mode or 'c' to start it
-in client mode. (This is to work around the lack of fork()).
-
-(Thanks to Nanbor Wang for working this out for us.)
-
-JCEJ - 08/01/1999
diff --git a/docs/tutorials/Chap_3/ex01.html b/docs/tutorials/Chap_3/ex01.html
deleted file mode 100644
index a722e9a9b6d..00000000000
--- a/docs/tutorials/Chap_3/ex01.html
+++ /dev/null
@@ -1,107 +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">////&nbsp; Chapter:&nbsp; "Memory 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">////&nbsp; 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="#CC0000">//Example 1&nbsp;</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Malloc.h"</FONT>
-<BR><FONT COLOR="#FF0000">//A chunk of size 1K is created</FONT>
-<BR><FONT COLOR="#000099">typedef</FONT> <FONT COLOR="#993300">char</FONT><FONT COLOR="#666600">
-MEMORY_BLOCK[1024];</FONT>
-<BR>&nbsp;
-<BR>&nbsp;
-
-<P><FONT COLOR="#FF0000">//Create an ACE_Cached_Allocator which is passed
-in the type of the</FONT>
-<BR><FONT COLOR="#FF0000">//chunk&nbsp; that it must pre-allocate and assign
-on the free</FONT>
-<BR><FONT COLOR="#FF0000">//list</FONT>
-<BR><FONT COLOR="#000000">typedef ACE_Cached_Allocator&lt;MEMORY_BLOCK,ACE_SYNCH_MUTEX>
-Allocator;</FONT>
-<BR>&nbsp;
-<BR>class MessageManager{
-<BR>public:
-<BR><FONT COLOR="#FF0000">//The constructor is passed the number of chunks
-that the allocator should pre-allocate //and maintain on its free list.</FONT>
-<BR>MessageManager(int n_blocks):
-<BR>&nbsp;allocator_(n_blocks),message_count_(0){}
-
-<P><FONT COLOR="#FF0000">//Allocate memory for a message using the Allocator</FONT>
-<BR>void allocate_msg(const char *msg){
-<BR>&nbsp;mesg_array_[message_count_]=
-<BR>&nbsp;&nbsp;&nbsp; (char*)allocator_.malloc(ACE_OS::strlen(msg));
-<BR>&nbsp;ACE_OS::strcpy(mesg_array_[message_count_],msg);
-<BR>&nbsp;message_count_++;
-<BR>&nbsp;}
-
-<P><FONT COLOR="#FF0000">//Free all memory allocated. This will cause the
-chunks to be returned</FONT>
-<BR><FONT COLOR="#FF0000">//to the allocators internal free list and NOT
-to the OS.</FONT>
-<BR>void free_all_msg(){
-<BR>&nbsp;for(int i=0;i&lt;message_count_;i++)
-<BR>&nbsp; allocator_.free(mesg_array_[i]);
-<BR>&nbsp;message_count_=0;
-<BR>&nbsp;}
-<BR>void display_all_msg(){
-<BR>&nbsp;for(int i=0;i&lt;message_count_;i++)
-<BR>&nbsp; ACE_OS::printf("%s\n",mesg_array_[i]);
-<BR>&nbsp;}
-<BR>&nbsp;
-<BR>private:
-<BR>&nbsp;char *mesg_array_[20];
-<BR>&nbsp;Allocator allocator_;
-<BR>&nbsp;int message_count_;
-<BR>};
-<BR>&nbsp;
-
-<P>int main(int argc, char* argv[]){
-
-<P>if(argc&lt;2){
-<BR>&nbsp;ACE_OS::printf("Usage: egXX &lt;Number of blocks>\n");
-<BR>&nbsp;exit(1);
-<BR>&nbsp;}
-<BR>&nbsp;
-<BR><FONT COLOR="#FF0000">//Instatiate the Memory Manager class</FONT>
-<BR>int n_blocks=ACE_OS::atoi(argv[1]);
-<BR>MessageManager mm(n_blocks);
-<BR>&nbsp;
-
-<P><FONT COLOR="#FF0000">//Use the Memory Manager class to assign messages
-and free them.</FONT> <FONT COLOR="#FF0000">Run this in your</FONT>
-<BR><FONT COLOR="#FF0000">//debug environment and you will notice that
-//the</FONT> <FONT COLOR="#FF0000">amount of memory your program uses</FONT>
-<BR><FONT COLOR="#FF0000">//after Memory Manager has been</FONT> <FONT COLOR="#FF0000">instantiated
-remains the same. That means the</FONT>
-<BR><FONT COLOR="#FF0000">//Cached Allocator</FONT> <FONT COLOR="#FF0000">controls
-or manages all the memory for the application.</FONT>
-
-<P><FONT COLOR="#FF0000">//Do forever.</FONT>
-<BR>while(1){
-<BR>&nbsp; <FONT COLOR="#FF0000">//allocate the messages somewhere</FONT>
-<BR>&nbsp;for(int i=0; i&lt;n_blocks;i++)
-<BR>&nbsp; mm.allocate_msg("Hi there");
-<BR>&nbsp;<FONT COLOR="#FF0000">//show the messages</FONT>
-<BR>&nbsp;mm.display_all_msg();
-<BR>&nbsp;
-<BR>&nbsp;for( i=0;i&lt;n_blocks;i++)
-<BR>&nbsp; mm.free_all_msg();
-<BR>&nbsp;}
-<BR>}
-
-<P>&nbsp;<A HREF="ex02.html">Next Example</A>
-</BODY>
-</HTML>
diff --git a/docs/tutorials/Chap_3/ex02.html b/docs/tutorials/Chap_3/ex02.html
deleted file mode 100644
index b425bfb9565..00000000000
--- a/docs/tutorials/Chap_3/ex02.html
+++ /dev/null
@@ -1,135 +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 2</TITLE>
-</HEAD>
-<BODY>
-<FONT COLOR="#CC0000">/////////////////////////////////////////////////////////////////////////////////////////////////////////////////</FONT>
-<BR><FONT COLOR="#CC0000">//// This example is from the ACE Programmers
-Guide.</FONT>
-<BR><FONT COLOR="#CC0000">////&nbsp; Chapter:&nbsp; "Memory 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">////&nbsp; 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="#CC0000">//Example 2</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Shared_Memory_MM.h"</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Malloc.h"</FONT>
-<BR><FONT COLOR="#000099">#include</FONT> <FONT COLOR="#006600">"ace/Malloc_T.h"</FONT>
-<BR><FONT COLOR="#000099">#define </FONT><FONT COLOR="#663366">DATA_SIZE
-100</FONT>
-<BR><FONT COLOR="#000099">#define</FONT><FONT COLOR="#663366"> MESSAGE1
-"Hiya over there client process"</FONT>
-<BR><FONT COLOR="#000099">#define </FONT><FONT COLOR="#663366">MESSAGE2&nbsp;
-"Did you hear me the first time?"</FONT>
-<BR>LPCTSTR poolname="My_Pool";
-
-<P><FONT COLOR="#000000">typedef ACE_Malloc&lt;ACE_SHARED_MEMORY_POOL,ACE_Null_Mutex>
-Malloc_Allocator;</FONT>
-
-<P>static void
-<BR>server (void){
-<BR>&nbsp;<FONT COLOR="#FF0000">//Create the memory allocator passing it
-the shared memory</FONT>
-<BR>&nbsp;<FONT COLOR="#FF0000">//pool that you want to use</FONT>
-<BR>&nbsp;Malloc_Allocator shm_allocator(poolname);
-
-<P>&nbsp;<FONT COLOR="#FF0000">//Create a message, allocate memory for
-it and bind it with</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//a name so that the client can the find
-it in the memory</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//pool</FONT>
-<BR>&nbsp;char* Message1=(char*)shm_allocator.malloc(strlen(MESSAGE1));
-<BR>&nbsp;ACE_OS::strcpy(Message1,MESSAGE1);
-<BR>&nbsp;shm_allocator.bind("FirstMessage",Message1);
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,"&lt;&lt;%s\n",Message1));
-<BR>&nbsp;
-<BR><FONT COLOR="#FF0000">&nbsp;//How about a second message</FONT>
-<BR>&nbsp;char* Message2=(char*)shm_allocator.malloc(strlen(MESSAGE2));
-<BR>&nbsp;ACE_OS::strcpy(Message2,MESSAGE2);
-<BR>&nbsp;shm_allocator.bind("SecondMessage",Message2);
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,"&lt;&lt;%s\n",Message2));
-<BR>&nbsp;
-<BR>&nbsp;<FONT COLOR="#FF0000">//Set the Server to go to sleep for a while
-so that the client has</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//a chance to do its stuff</FONT>
-<BR>&nbsp;ACE_DEBUG((LM_DEBUG,
-<BR>&nbsp;&nbsp;&nbsp; "Server done writing.. going to sleep zzz..\n\n\n"));
-<BR>&nbsp;ACE_OS::sleep(2);
-<BR>&nbsp;
-<BR><FONT COLOR="#FF0000">&nbsp;//Get rid of all resources allocated by
-the server. In other</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//words get rid of the shared memory pool
-that had been</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//previously allocated</FONT>
-<BR>&nbsp;shm_allocator.remove();
-<BR>&nbsp;
-<BR>}
-<BR>&nbsp;
-
-<P>static void
-<BR>client(void){
-<BR>&nbsp;<FONT COLOR="#FF0000">//Create a memory allocator. Be sure that
-the client passes</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;// in the "right" name here so that both
-the client and the</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//server use the same memory pool. We wouldnt
-want them to</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;// BOTH create different underlying pools.</FONT>
-<BR>&nbsp;Malloc_Allocator shm_allocator(poolname);
-
-<P><FONT COLOR="#FF0000">&nbsp;//Lets get that first message. Notice that
-the find is looking up the</FONT>
-<BR><FONT COLOR="#FF0000">&nbsp;//memory based on the "name" that was bound
-to it by the server.</FONT>
-<BR>&nbsp;void *Message1;
-<BR>&nbsp;if(shm_allocator.find("FirstMessage",Message1)==-1){
-<BR>&nbsp; ACE_ERROR((LM_ERROR,
-<BR>&nbsp;&nbsp;&nbsp; "Client: Problem cant find data that server has
-sent\n"));
-<BR>&nbsp; ACE_OS::exit(1);
-<BR>&nbsp; }
-<BR>&nbsp;ACE_OS::printf(">>%s\n",(char*) Message1);
-<BR>&nbsp;ACE_OS::fflush(stdout);
-
-<P>&nbsp;<FONT COLOR="#FF0000">//Lets get that second message now.</FONT>
-<BR>&nbsp;void *Message2;
-<BR>&nbsp;if(shm_allocator.find("SecondMessage",Message2)==-1){
-<BR>&nbsp; ACE_ERROR((LM_ERROR,"Client: Problem cant find data that server
-has sent\n"));
-<BR>&nbsp; ACE_OS::exit(1);
-<BR>&nbsp; }
-<BR>&nbsp;ACE_OS::printf(">>%s\n",(char*)Message2);
-<BR>&nbsp;ACE_OS::fflush(stdout);
-
-<P>&nbsp;ACE_DEBUG((LM_DEBUG,"Client done reading! BYE NOW\n"));
-<BR>&nbsp;ACE_OS::fflush(stdout);
-<BR>}
-<BR>&nbsp;
-
-<P>int main (int, char *[]){
-<BR>switch (ACE_OS::fork ())
-<BR>&nbsp;&nbsp;&nbsp; {
-<BR>&nbsp;&nbsp;&nbsp; case -1:
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_ERROR_RETURN ((LM_ERROR, "%p\n",
-"fork"), 1);
-<BR>&nbsp;&nbsp;&nbsp; case 0:
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT COLOR="#FF0000"> // Make sure the
-server starts up first.</FONT>
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_OS::sleep (1);
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; client ();
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;
-<BR>&nbsp;&nbsp;&nbsp; default:
-<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server ();
-<BR>&nbsp;&nbsp;&nbsp; break;
-<BR>&nbsp;}
-<BR>&nbsp; return 0;
-<BR>}
-<BR>&nbsp;
-<BR>&nbsp;<A HREF="../Chap_4/ex01.html">Next Example</A>
-</BODY>
-</HTML>
diff --git a/docs/tutorials/Chap_3/ex03.html b/docs/tutorials/Chap_3/ex03.html
deleted file mode 100644
index 743f0b395d2..00000000000
--- a/docs/tutorials/Chap_3/ex03.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<PRE>
-<font color=red>// $Id$</font>
-
-<font color=blue>#include</font> "<font color=green>ace/Memory_Pool.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/Shared_Memory_MM.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/Malloc.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/Malloc_T.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/Thread_Manager.h</font>"
-
-<font color=blue>#define</font> <font color=purple>DATA_SIZE</font> 100
-<font color=blue>#define</font> <font color=purple>MESSAGE1</font> "<font color=green>Hiya over there client process</font>"
-<font color=blue>#define</font> <font color=purple>MESSAGE2</font> "<font color=green>Did you hear me the first time?</font>"
-LPCTSTR poolname="<font color=green>My_Pool</font>";
-
-typedef ACE_Malloc&lt;ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> Malloc_Allocator;
-
-static void *
-server (void * = 0)
-{
- ACE_MMAP_Memory_Pool_Options opt;
-
- <font color=red>//Create the memory allocator passing it the shared memory</font>
- <font color=red>//pool that you want to use</font>
- Malloc_Allocator shm_allocator(poolname,poolname,&opt);
-
- <font color=red>//Create a message, allocate memory for it and bind it with</font>
- <font color=red>//a name so that the client can the find it in the memory</font>
- <font color=red>//pool</font>
- char* Message1=(char*)shm_allocator.malloc(strlen(MESSAGE1)+1);
-
- <font color=#008888>ACE_OS::strcpy</font>(Message1,MESSAGE1);
- shm_allocator.bind("<font color=green>FirstMessage</font>",Message1);
- ACE_DEBUG((LM_DEBUG,"<font color=green>&lt;&lt;%s\n</font>",Message1));
-
- <font color=red>//How about a second message</font>
- char* Message2=(char*)shm_allocator.malloc(strlen(MESSAGE2)+1);
- <font color=#008888>ACE_OS::strcpy</font>(Message2,MESSAGE2);
- shm_allocator.bind("<font color=green>SecondMessage</font>",Message2);
- ACE_DEBUG((LM_DEBUG,"<font color=green>&lt;&lt;%s\n</font>",Message2));
-
- <font color=red>//Set the Server to go to sleep for a while so that the client has</font>
- <font color=red>//a chance to do its stuff</font>
- ACE_DEBUG((LM_DEBUG, "<font color=green>Server done writing.. going to sleep zzz..\n\n\n</font>"));
- <font color=#008888>ACE_OS::sleep</font>(10);
-
- ACE_DEBUG ((LM_DEBUG, "<font color=green>server exit\n</font>"));
-
- return 0;
-}
-
-static void *
-client (void * = 0)
-{
- ACE_MMAP_Memory_Pool_Options opt;
-
- <font color=red>//Create the memory allocator passing it the shared memory</font>
- <font color=red>//pool that you want to use</font>
- Malloc_Allocator shm_allocator(poolname,poolname,&opt);
-
- <font color=red>//Lets get that first message. Notice that the find is looking up the</font>
- <font color=red>//memory based on the "<font color=green>name</font>" that was bound to it by the server.</font>
- void *Message1 = 0;
- if(shm_allocator.find("<font color=green>FirstMessage</font>") == -1 )
- {
- ACE_ERROR((LM_ERROR,
- "<font color=green>Client ack\n</font>"));
- return 0;
- }
- if(shm_allocator.find("<font color=green>FirstMessage</font>",Message1)==-1)
- {
- ACE_ERROR((LM_ERROR,
- "<font color=green>Client: Problem cant find data that server has sent\n</font>"));
- return 0;
- }
-
- <font color=#008888>ACE_OS::printf</font>("<font color=green>>>%s\n</font>",(char*) Message1);
- <font color=#008888>ACE_OS::fflush</font>(stdout);
-
- <font color=red>//Lets get that second message now.</font>
- void *Message2;
- if(shm_allocator.find("<font color=green>SecondMessage</font>",Message2)==-1)
- {
- ACE_ERROR((LM_ERROR,
- "<font color=green>Client: Problem cant find data that server has sent\n</font>"));
- <font color=#008888>ACE_OS::exit</font>(1);
- }
- <font color=#008888>ACE_OS::printf</font>("<font color=green>>>%s\n</font>",(char*)Message2);
- <font color=#008888>ACE_OS::fflush</font>(stdout);
-
- ACE_DEBUG((LM_DEBUG,"<font color=green>Client done reading! BYE NOW\n</font>"));
- <font color=#008888>ACE_OS::fflush</font>(stdout);
-
- <font color=red>//Get rid of all resources allocated by the server. In other</font>
- <font color=red>//words get rid of the shared memory pool that had been</font>
- <font color=red>//previously allocated</font>
- shm_allocator.remove();
-
- return 0;
-}
-
-int main (int, char *argv[])
-{
- switch (*argv[1])
- {
- case 's':
- server ();
- break;
- default:
- client ();
- break;
- }
-
- return 0;
-}
-</PRE>
diff --git a/docs/tutorials/Chap_3/mm.cpp b/docs/tutorials/Chap_3/mm.cpp
deleted file mode 100644
index 2be56fbcc9a..00000000000
--- a/docs/tutorials/Chap_3/mm.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// $Id$
-
-#include "ace/Memory_Pool.h"
-#include "ace/Shared_Memory_MM.h"
-#include "ace/Malloc.h"
-#include "ace/Malloc_T.h"
-#include "ace/Thread_Manager.h"
-
-#define DATA_SIZE 100
-#define MESSAGE1 "Hiya over there client process"
-#define MESSAGE2 "Did you hear me the first time?"
-LPCTSTR poolname="My_Pool";
-
-typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> Malloc_Allocator;
-
-static void *
-server (void * = 0)
-{
- ACE_MMAP_Memory_Pool_Options opt;
-
- //Create the memory allocator passing it the shared memory
- //pool that you want to use
- Malloc_Allocator shm_allocator(poolname,poolname,&opt);
-
- //Create a message, allocate memory for it and bind it with
- //a name so that the client can the find it in the memory
- //pool
- char* Message1=(char*)shm_allocator.malloc(strlen(MESSAGE1)+1);
-
- ACE_OS::strcpy(Message1,MESSAGE1);
- shm_allocator.bind("FirstMessage",Message1);
- ACE_DEBUG((LM_DEBUG,"<<%s\n",Message1));
-
- //How about a second message
- char* Message2=(char*)shm_allocator.malloc(strlen(MESSAGE2)+1);
- ACE_OS::strcpy(Message2,MESSAGE2);
- shm_allocator.bind("SecondMessage",Message2);
- ACE_DEBUG((LM_DEBUG,"<<%s\n",Message2));
-
- //Set the Server to go to sleep for a while so that the client has
- //a chance to do its stuff
- ACE_DEBUG((LM_DEBUG, "Server done writing.. going to sleep zzz..\n\n\n"));
- ACE_OS::sleep(10);
-
- ACE_DEBUG ((LM_DEBUG, "server exit\n"));
-
- return 0;
-}
-
-static void *
-client (void * = 0)
-{
- ACE_MMAP_Memory_Pool_Options opt;
-
- //Create the memory allocator passing it the shared memory
- //pool that you want to use
- Malloc_Allocator shm_allocator(poolname,poolname,&opt);
-
- //Lets get that first message. Notice that the find is looking up the
- //memory based on the "name" that was bound to it by the server.
- void *Message1 = 0;
- if(shm_allocator.find("FirstMessage") == -1 )
- {
- ACE_ERROR((LM_ERROR,
- "Client ack\n"));
- return 0;
- }
- if(shm_allocator.find("FirstMessage",Message1)==-1)
- {
- ACE_ERROR((LM_ERROR,
- "Client: Problem cant find data that server has sent\n"));
- return 0;
- }
-
- ACE_OS::printf(">>%s\n",(char*) Message1);
- ACE_OS::fflush(stdout);
-
- //Lets get that second message now.
- void *Message2;
- if(shm_allocator.find("SecondMessage",Message2)==-1)
- {
- ACE_ERROR((LM_ERROR,
- "Client: Problem cant find data that server has sent\n"));
- ACE_OS::exit(1);
- }
- ACE_OS::printf(">>%s\n",(char*)Message2);
- ACE_OS::fflush(stdout);
-
- ACE_DEBUG((LM_DEBUG,"Client done reading! BYE NOW\n"));
- ACE_OS::fflush(stdout);
-
- //Get rid of all resources allocated by the server. In other
- //words get rid of the shared memory pool that had been
- //previously allocated
- shm_allocator.remove();
-
- return 0;
-}
-
-int main (int, char *argv[])
-{
- switch (*argv[1])
- {
- case 's':
- server ();
- break;
- default:
- client ();
- break;
- }
-
- return 0;
-}