summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2003-04-09 17:14:24 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2003-04-09 17:14:24 +0000
commitb6f30a7aac5793854b319e7a824787d10d48d29d (patch)
treef185d49769c4f16ec10d4a446672d3f2e20fedd6 /examples
parent3f2c5466c98296f743b01ad6245ec8ca1dad53cc (diff)
downloadATCD-b6f30a7aac5793854b319e7a824787d10d48d29d.tar.gz
ChangeLogTag: Wed Apr 09 19:13:12 2002 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'examples')
-rw-r--r--examples/Reactor/Misc/test_event_handler_t.cpp2
-rw-r--r--examples/Reactor/Ntalker/ntalker.cpp13
-rw-r--r--examples/System_V_IPC/SV_Message_Queues/MQ_Client.cpp26
-rw-r--r--examples/System_V_IPC/SV_Message_Queues/MQ_Server.cpp12
-rw-r--r--examples/System_V_IPC/SV_Message_Queues/TMQ_Server.cpp13
-rw-r--r--examples/System_V_IPC/SV_Shared_Memory/SV_Shared_Memory_Test.cpp16
6 files changed, 67 insertions, 15 deletions
diff --git a/examples/Reactor/Misc/test_event_handler_t.cpp b/examples/Reactor/Misc/test_event_handler_t.cpp
index a944c739ac5..f5195d17aff 100644
--- a/examples/Reactor/Misc/test_event_handler_t.cpp
+++ b/examples/Reactor/Misc/test_event_handler_t.cpp
@@ -15,7 +15,7 @@ public:
virtual void set_handle (ACE_HANDLE) {}
virtual int handle_async_io (ACE_HANDLE) { return 0; }
virtual int shutdown (ACE_HANDLE, ACE_Reactor_Mask) { return 0; }
- virtual int signal_handler (ACE_HANDLE /* signum */,
+ virtual int signal_handler (int /* signum */,
siginfo_t * = 0,
ucontext_t * = 0)
{
diff --git a/examples/Reactor/Ntalker/ntalker.cpp b/examples/Reactor/Ntalker/ntalker.cpp
index 547de486d50..3b4019044fa 100644
--- a/examples/Reactor/Ntalker/ntalker.cpp
+++ b/examples/Reactor/Ntalker/ntalker.cpp
@@ -29,8 +29,8 @@ public:
// = Initialization and termination methods.
Handler (u_short udp_port,
const char *ip_addr,
- const ACE_TCHAR *interface,
- ACE_Reactor &);
+ const ACE_TCHAR *a_interface,
+ ACE_Reactor & );
// Constructor.
~Handler (void);
@@ -141,7 +141,7 @@ Handler::~Handler (void)
Handler::Handler (u_short udp_port,
const char *ip_addr,
- const ACE_TCHAR *interface,
+ const ACE_TCHAR *a_interface,
ACE_Reactor &reactor)
{
// Create multicast address to listen on.
@@ -150,11 +150,12 @@ Handler::Handler (u_short udp_port,
// subscribe to multicast group.
- if (this->mcast_.subscribe (sockmc_addr, 1, interface) == -1)
- ACE_ERROR ((LM_ERROR,
+ if (this->mcast_.subscribe (sockmc_addr, 1, a_interface) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
"%p\n",
"can't subscribe to multicast group"));
-
+ }
// Disable loopbacks.
// if (this->mcast_.set_option (IP_MULTICAST_LOOP, 0) == -1 )
// ACE_OS::perror (" can't disable loopbacks " ), ACE_OS::exit (1);
diff --git a/examples/System_V_IPC/SV_Message_Queues/MQ_Client.cpp b/examples/System_V_IPC/SV_Message_Queues/MQ_Client.cpp
index 79b70627168..9a6020d590c 100644
--- a/examples/System_V_IPC/SV_Message_Queues/MQ_Client.cpp
+++ b/examples/System_V_IPC/SV_Message_Queues/MQ_Client.cpp
@@ -3,10 +3,13 @@
#include "ace/SV_Message_Queue.h"
#include "test.h"
#include "ace/streams.h"
+#include "ace/Malloc.h"
ACE_RCSID(SV_Message_Queues, MQ_Client, "$Id$")
-int
+#if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)
+
+int
main (int, char *[])
{
long pid = long (ACE_OS::getpid ());
@@ -23,13 +26,24 @@ main (int, char *[])
if (msgque.recv (recv_msg, sizeof (Message_Data), recv_msg.type ()) < 0)
ACE_OS::perror ("msgrcv"), ACE_OS::exit (1);
- cout << "a message of length "
+ cout << "a message of length "
<< recv_msg.length ()
- << " received from server "
- << recv_msg.pid ()
- << " (user "
- << recv_msg.user () << "): "
+ << " received from server "
+ << recv_msg.pid ()
+ << " (user "
+ << recv_msg.user () << "): "
<< recv_msg.text () << "\n";
return 0;
}
+
+#else
+
+int main (int, char *[])
+{
+ ACE_ERROR ((LM_ERROR,
+ "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
+ return 0;
+}
+#endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM*/
+
diff --git a/examples/System_V_IPC/SV_Message_Queues/MQ_Server.cpp b/examples/System_V_IPC/SV_Message_Queues/MQ_Server.cpp
index 6e42d0d2629..7b6bca929f8 100644
--- a/examples/System_V_IPC/SV_Message_Queues/MQ_Server.cpp
+++ b/examples/System_V_IPC/SV_Message_Queues/MQ_Server.cpp
@@ -7,6 +7,8 @@
ACE_RCSID(SV_Message_Queues, MQ_Server, "$Id$")
+#if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)
+
// Must be global for signal Message...
static ACE_SV_Message_Queue ace_sv_message_queue (SRV_KEY,
ACE_SV_Message_Queue::ACE_CREATE);
@@ -59,3 +61,13 @@ main (int, char *[])
ACE_NOTREACHED (return 0;)
}
+
+#else
+
+int main (int, char *[])
+{
+ ACE_ERROR ((LM_ERROR,
+ "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
+ return 0;
+}
+#endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM */
diff --git a/examples/System_V_IPC/SV_Message_Queues/TMQ_Server.cpp b/examples/System_V_IPC/SV_Message_Queues/TMQ_Server.cpp
index db0c2ae9a03..373c92dae79 100644
--- a/examples/System_V_IPC/SV_Message_Queues/TMQ_Server.cpp
+++ b/examples/System_V_IPC/SV_Message_Queues/TMQ_Server.cpp
@@ -9,6 +9,8 @@
ACE_RCSID(SV_Message_Queues, TMQ_Server, "$Id$")
+#if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)
+
// Must be global for signal Message...
static ACE_Typed_SV_Message_Queue<Message_Data> ace_sv_message_queue
(SRV_KEY, ACE_Typed_SV_Message_Queue<Message_Data>::ACE_CREATE);
@@ -65,3 +67,14 @@ template class ACE_Typed_SV_Message<Message_Data>;
#pragma instantiate ACE_Typed_SV_Message_Queue<Message_Data>
#pragma instantiate ACE_Typed_SV_Message<Message_Data>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+#else
+
+int main (int, char *[])
+{
+ ACE_ERROR ((LM_ERROR,
+ "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
+ return 0;
+}
+#endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM */
+
diff --git a/examples/System_V_IPC/SV_Shared_Memory/SV_Shared_Memory_Test.cpp b/examples/System_V_IPC/SV_Shared_Memory/SV_Shared_Memory_Test.cpp
index e0aae71f3fc..0a7d718009d 100644
--- a/examples/System_V_IPC/SV_Shared_Memory/SV_Shared_Memory_Test.cpp
+++ b/examples/System_V_IPC/SV_Shared_Memory/SV_Shared_Memory_Test.cpp
@@ -5,6 +5,8 @@
ACE_RCSID(SV_Shared_Memory, SV_Shared_Memory_Test, "$Id$")
+#if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)
+
static void
client (void)
{
@@ -51,8 +53,8 @@ main (int, char *argv[])
{
case -1:
ACE_OS::perror (argv[0]), ACE_OS::exit (1);
- case 0:
- ACE_OS::sleep (1);
+ case 0:
+ ACE_OS::sleep (1);
client ();
default:
server ();
@@ -60,3 +62,13 @@ main (int, char *argv[])
return 0;
}
+#else
+
+int main (int, char *[])
+{
+ ACE_ERROR ((LM_ERROR,
+ "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
+ return 0;
+}
+#endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM/
+