summaryrefslogtreecommitdiff
path: root/examples/System_V_IPC
diff options
context:
space:
mode:
Diffstat (limited to 'examples/System_V_IPC')
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp31
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp42
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h11
-rw-r--r--examples/System_V_IPC/SV_Semaphores/Semaphores.cpp94
4 files changed, 0 insertions, 178 deletions
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp
deleted file mode 100644
index b7fe34725e7..00000000000
--- a/examples/System_V_IPC/SV_Semaphores/Semaphore_Client.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "Semaphore_Test.h"
-// $Id$
-
-#include "ace/SV_Shared_Memory.h"
-#include "ace/SV_Semaphore_Simple.h"
-
-int
-main (void)
-{
- ACE_SV_Shared_Memory shm_client (SHM_KEY,
- SHMSZ,
- ACE_SV_Shared_Memory::ACE_OPEN);
- ACE_SV_Semaphore_Simple sem (SEM_KEY_1,
- ACE_SV_Semaphore_Simple::ACE_OPEN, 0, 2);
-
- char *s = (char *) shm_client.get_segment_ptr ();
-
- if (sem.acquire (0) < 0)
- ACE_OS::perror ("client sem.acquire"), ACE_OS::exit (1);
-
- while (*s != '\0')
- putchar (*s++);
-
- putchar ('\n');
-
- if (sem.release (1) < 0)
- ACE_OS::perror ("client sem.release"), ACE_OS::exit (1);
-
- return 0;
-}
-
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp
deleted file mode 100644
index f9931705c26..00000000000
--- a/examples/System_V_IPC/SV_Semaphores/Semaphore_Server.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// $Id$
-
-
-#include "ace/SV_Shared_Memory.h"
-#include "ace/SV_Semaphore_Simple.h"
-#include "ace/Signal.h"
-#include "Semaphore_Test.h"
-
-static ACE_SV_Shared_Memory shm_server (SHM_KEY, SHMSZ, ACE_SV_Shared_Memory::ACE_CREATE);
-static ACE_SV_Semaphore_Simple sem (SEM_KEY_1, ACE_SV_Semaphore_Simple::ACE_CREATE, 0, 2);
-
-extern "C" void
-cleanup (int)
-{
- if (shm_server.remove () < 0 || sem.remove () < 0)
- ACE_ERROR ((LM_ERROR, "%p\n%a", "remove", 1));
- ACE_OS::exit (0);
-}
-
-int
-main (void)
-{
- // Register a signal handler.
- ACE_Sig_Action sa ((ACE_SignalHandler) cleanup, SIGINT);
-
- char *s = (char *) shm_server.get_segment_ptr ();
-
- for (char c = 'a'; c <= 'z'; c++)
- *s++ = c;
-
- *s = '\0';
-
- if (sem.release (0) < 0)
- ESD ("server sem.release", done);
-
- if (sem.acquire (1) < 0)
- ESD ("server sem.acquire", done);
-
-done:
- cleanup ();
- return 0;
-}
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h b/examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h
deleted file mode 100644
index 72aab815ff8..00000000000
--- a/examples/System_V_IPC/SV_Semaphores/Semaphore_Test.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-#include "ace/Log_Msg.h"
-
-#define SHMSZ 27
-#define SEM_KEY_1 2345
-#define SEM_KEY_2 4321
-#define SHM_KEY 5678
-
-#define ESD(MSG,LABEL) do { ACE_ERROR ((LM_ERROR, MSG)); goto LABEL; } while (0)
diff --git a/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp b/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp
deleted file mode 100644
index b98c664883b..00000000000
--- a/examples/System_V_IPC/SV_Semaphores/Semaphores.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Illustrates the use of the Semaphore_Complex class. Note that it
-// $Id$
-
-// doesn't matter whether the parent or the child creates the
-// semaphore since Semaphore_Complex will correctly serialize the
-// intialization of the mutex and synch objects.
-#include "ace/Malloc.h"
-#include "ace/SV_Semaphore_Complex.h"
-#include "Semaphore_Test.h"
-
-ACE_Malloc<ACE_Shared_Memory_Pool, ACE_SV_Semaphore_Simple> allocator;
-ACE_SV_Semaphore_Complex *mutex = 0;
-ACE_SV_Semaphore_Complex *synch = 0;
-
-/* Pointer to memory shared by both the client and server. */
-static char *shm;
-
-static int
-do_parent (void)
-{
- char *s = shm;
-
- mutex = new ACE_SV_Semaphore_Complex (SEM_KEY_1, ACE_SV_Semaphore_Complex::ACE_CREATE, 0);
- synch = new ACE_SV_Semaphore_Complex (SEM_KEY_2, ACE_SV_Semaphore_Complex::ACE_CREATE, 0);
-
- for (char c = 'a'; c <= 'z'; c++)
- *s++ = c;
-
- *s = '\0';
-
- if (mutex->release () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p", "server mutex.release"), 1);
-
- if (synch->acquire () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p", "server synch.acquire"), 1);
- return 0;
-}
-
-static int
-do_child (void)
-{
- mutex = new ACE_SV_Semaphore_Complex (SEM_KEY_1, ACE_SV_Semaphore_Complex::ACE_CREATE, 0);
- synch = new ACE_SV_Semaphore_Complex (SEM_KEY_2, ACE_SV_Semaphore_Complex::ACE_CREATE, 0);
-
- while (mutex->tryacquire () == -1)
- if (errno == EAGAIN)
- ACE_DEBUG ((LM_DEBUG, "spinning in client!\n"));
- else
- ACE_ERROR_RETURN ((LM_ERROR, "client mutex.tryacquire"), 1);
-
- for (char *s = (char *) shm; *s != '\0'; s++)
- putchar (*s);
-
- putchar ('\n');
-
- if (synch->release () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "client synch.release"), 1);
- return 0;
-}
-
-int
-main (void)
-{
- shm = (char *) allocator.malloc (27);
-
- switch (ACE_OS::fork ())
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "fork failed\n"), -1);
- /* NOTREACHED */
- case 0:
- return do_child ();
- default:
- {
- int result = do_parent ();
-
- if (wait (0) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "wait"), -1);
-
- allocator.remove ();
-
- if (mutex->remove () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mutex.remove"), -1);
- else if (synch->remove () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "synch.remove"), -1);
- return result;
- }
- }
-}
-
-#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class ACE_Malloc<ACE_Shared_Memory_Pool, ACE_SV_Semaphore_Simple>;
-#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
-