diff options
Diffstat (limited to 'docs/tutorials/020/page02.html')
-rw-r--r-- | docs/tutorials/020/page02.html | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/docs/tutorials/020/page02.html b/docs/tutorials/020/page02.html deleted file mode 100644 index 38d27404fa8..00000000000 --- a/docs/tutorials/020/page02.html +++ /dev/null @@ -1,77 +0,0 @@ -<!-- $Id$ --> -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="James CE Johnson"> - <TITLE>ACE Tutorial 020</TITLE> -</HEAD> -<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> - -<CENTER><B><FONT SIZE=+2>ACE Tutorial 020</FONT></B></CENTER> - -<CENTER><B><FONT SIZE=+2>Sharing your Memories with persistence</FONT></B></CENTER> - -<P> -<HR WIDTH="100%"> - Here's our new server using a memory mapped file instead of Unix - System V shared memory. Print out both servers and hold 'em up - to a strong light. I think you'll see there isn't much - difference. - <p> - The filename is defined in mmap.h as <i>mmapfile</i>. You can - <i>cat</i> it any time to see what's in there. If you're - feeling brave, try writting some data into it. On my system it - causes unpleasant things to happen. I'd recommend that you - don't do that! -<hr> -<PRE> - -<font color=red>// $Id$</font> - -<font color=blue>#include</font> "<font color=green>mmap.h</font>" - -<font color=blue>#include</font> "<A HREF="../../../ace/Log_Msg.h">ace/Log_Msg.h</A>" - -int -main (int, char *[]) -{ - <font color=red>/* - The default behavior of the memory map wrapper is to create - the file if it doesn't exist. This is a minor change from - the SV shared memory wrapper. - */</font> - ACE_Shared_Memory_MM shm_server (SHM_KEY, SHMSZ); - char *shm = (char *) shm_server.malloc (); - char *s = shm; - - ACE_DEBUG ((LM_INFO, "<font color=green>(%P|%t) Memory Mapped file is at 0x%x\n</font>", - shm )); - - for (char c = 'a'; c <= 'z'; c++) - *s++ = c; - - *s = '\0'; - - while (*shm != '*') - <font color=#008888>ACE_OS::sleep</font> (1); - - for (s = shm; *s != '\0'; s++) - { - putchar (*s); - } - - putchar ('\n'); - - if (shm_server.remove () < 0) - ACE_ERROR ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>remove</font>")); - - return 0; -} - -</PRE> -<HR> -BTW: In ACE 4.6.7 and prior there is a bug that prevents the remove() - method from actually removing the physical file. -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page03.html">Continue This Tutorial</A>]</CENTER> - |