diff options
Diffstat (limited to 'docs/tutorials/020/page04.html')
-rw-r--r-- | docs/tutorials/020/page04.html | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/docs/tutorials/020/page04.html b/docs/tutorials/020/page04.html deleted file mode 100644 index 93155c27c49..00000000000 --- a/docs/tutorials/020/page04.html +++ /dev/null @@ -1,87 +0,0 @@ -<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%"> -I wanted to show placement new again & prove that you can use it with - a memory mapped file just as easily as with a shared memory - segment. - <p> -Imagine if you had an object that contained an image & then you mapped - that to a file... Instead of a bunch of jpg files laying - around, you would actually have objects instead. Save the - image? No problem, it's already there! -<hr> -<HR width=50%><P><center>server2.cpp</center><HR width=50%> -<PRE> - -<font color=red>// $Id$</font> - -<font color=blue>#include</font> "<font color=green>mmap.h</font>" - -int -main (int, char *[]) -{ - ACE_Shared_Memory_MM shm_server (SHM_KEY, sizeof(SharedData) ); - - char *shm = (char *) shm_server.malloc (); - - ACE_DEBUG ((LM_INFO, "<font color=green>(%P|%t) Memory Mapped file is at 0x%x\n</font>", - shm )); - - SharedData * sd = new(shm) SharedData; - - sd->set(); - sd->available(0); - - while ( ! sd->available() ) - <font color=#008888>ACE_OS::sleep</font> (1); - - sd->show(); - - if (shm_server.remove () < 0) - ACE_ERROR ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>remove</font>")); - - return 0; -} - -</PRE> -<HR width=50%><P><center>client2.cpp</center><HR width=50%> -<PRE> - -<font color=red>// $Id$</font> - -<font color=blue>#include</font> "<font color=green>mmap.h</font>" - -int main (int, char *[]) -{ - ACE_Shared_Memory_MM shm_client (SHM_KEY, sizeof(SharedData)); - - char *shm = (char *) shm_client.malloc (); - - ACE_DEBUG ((LM_INFO, "<font color=green>(%P|%t) Memory Mapped file is at 0x%x\n</font>", - shm )); - - SharedData * sd = new(shm) SharedData(0); - - sd->show(); - sd->set(); - sd->available(1); - - shm_client.close(); - - return 0; -} - -</PRE> -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page05.html">Continue This Tutorial</A>]</CENTER> |