1 #include "ace/Signal.h"
2 #include "ace/SV_Message_Queue.h"
4 // FUZZ: disable check_for_streams_include
5 #include "ace/streams.h"
8 #include "ace/OS_NS_stdio.h"
9 #include "ace/OS_NS_unistd.h"
10 #include "ace/OS_NS_stdlib.h"
13 #if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)
15 // Must be global for signal Message...
16 static ACE_SV_Message_Queue
ace_sv_message_queue (SRV_KEY
,
17 ACE_SV_Message_Queue::ACE_CREATE
);
22 if (ace_sv_message_queue
.remove () < 0)
23 ACE_OS::perror ("ace_sv_message_queue.close"), ACE_OS::exit (1);
28 ACE_TMAIN (int, ACE_TCHAR
*[])
30 long pid
= long (ACE_OS::getpid ());
31 Message_Block
recv_msg (SRV_ID
);
32 Message_Block
send_msg (0,
34 ACE_OS::cuserid (static_cast<char *> (0)),
35 "I received your message.");
37 // Register a signal handler.
38 ACE_Sig_Action
sa ((ACE_SignalHandler
) handler
, SIGINT
);
43 if (ace_sv_message_queue
.recv (recv_msg
,
44 sizeof (Message_Data
),
45 recv_msg
.type ()) == -1)
46 ACE_OS::perror ("ace_sv_message_queue.recv"), ACE_OS::exit (1);
48 cout
<< "a msg of length "
50 << " sent from client "
53 << recv_msg
.user () << "): "
54 << recv_msg
.text () << "\n";
58 send_msg
.type (recv_msg
.pid ());
60 if (ace_sv_message_queue
.send (send_msg
,
61 send_msg
.length ()) == -1)
62 ACE_OS::perror ("ace_sv_message_queue.send"), ACE_OS::exit (1);
65 ACE_NOTREACHED (return 0;)
70 #include "ace/Log_Msg.h"
72 int ACE_TMAIN (int, ACE_TCHAR
*[])
75 "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
78 #endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM */