summaryrefslogtreecommitdiff
path: root/examples/Shared_Memory/test_MM.cpp
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-01-01 08:00:34 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-01-01 08:00:34 +0000
commitd9661aebab28abc0ec4fb1e716170d347d56c168 (patch)
treeecb671ab4b8e299bf5cbb8b2dfeed8a49b65fc06 /examples/Shared_Memory/test_MM.cpp
parentea0d28240863caf437a18071bfd03e7b146c5ade (diff)
downloadATCD-unlabeled-4.3.2.tar.gz
This commit was manufactured by cvs2svn to create branchunlabeled-4.3.2
'unlabeled-4.3.2'.
Diffstat (limited to 'examples/Shared_Memory/test_MM.cpp')
-rw-r--r--examples/Shared_Memory/test_MM.cpp64
1 files changed, 0 insertions, 64 deletions
diff --git a/examples/Shared_Memory/test_MM.cpp b/examples/Shared_Memory/test_MM.cpp
deleted file mode 100644
index b165ab9fb8a..00000000000
--- a/examples/Shared_Memory/test_MM.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-// $Id$
-
-#include "ace/Shared_Memory_MM.h"
-
-#define SHMSZ 27
-char shm_key[] = "/tmp/fooXXXXXX";
-
-static void
-client (void)
-{
- ACE_Shared_Memory *shm_client = new ACE_Shared_Memory_MM (shm_key);
- char *shm = (char *) shm_client->malloc ();
-
- for (char *s = shm; *s != '\0'; s++)
- putchar (*s);
-
- putchar ('\n');
- *shm = '*';
-}
-
-static void
-server (void)
-{
- ACE_Shared_Memory *shm_server = new ACE_Shared_Memory_MM (shm_key, SHMSZ);
- char *shm = (char *) shm_server->malloc ();
- char *s = shm;
-
- for (char c = 'a'; c <= 'z'; c++)
- *s++ = c;
-
- *s = '\0';
-
- // Perform a busy wait (ugh)
- while (*shm != '*')
- ACE_OS::sleep (1);
-
- if (shm_server->remove () < 0)
- ACE_ERROR ((LM_ERROR, "%p\n", "remove"));
- ACE_OS::unlink (shm_key);
-}
-
-int
-main (int, char *[])
-{
- if (ACE_OS::mktemp (shm_key) == 0 || (ACE_OS::unlink (shm_key) == -1 && errno == EPERM))
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", shm_key), 1);
-
- switch (ACE_OS::fork ())
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "fork"), 1);
- case 0:
- // Make sure the server starts up first.
- ACE_OS::sleep (1);
- client ();
- break;
- default:
- server ();
- break;
- }
- return 0;
-}
-