Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / Connection / blocking / SPIPE-acceptor.h
blobdd57e9930559c6e2b6ab8af6974f80f8d5848bbb
1 /* -*- C++ -*- */
2 #ifndef SP_ACCEPTOR_H
3 #define SP_ACCEPTOR_H
5 #include "ace/Svc_Handler.h"
6 #include "ace/Service_Config.h"
8 #if !defined (ACE_LACKS_PRAGMA_ONCE)
9 # pragma once
10 #endif /* ACE_LACKS_PRAGMA_ONCE */
12 #include "ace/Acceptor.h"
13 #include "ace/SPIPE_Stream.h"
14 #include "ace/SPIPE_Acceptor.h"
15 #include "ace/Asynch_IO.h"
17 // This only works on Win32 platforms and on Unix platforms
18 // supporting POSIX aio calls.
19 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
21 // This is the class that does the work once the ACE_Oneshot_Acceptor
22 // has accepted a connection.
24 class Svc_Handler : public ACE_Svc_Handler <ACE_SPIPE_STREAM, ACE_NULL_SYNCH>, public ACE_Handler
26 public:
27 Svc_Handler ();
28 ~Svc_Handler ();
30 virtual int open (void *);
32 virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result &result);
33 // This is called when asynchronous read from the socket complete
34 // Handle data from the client.
36 private:
37 ACE_Asynch_Read_Stream ar_;
38 ACE_Message_Block mb_;
41 class IPC_Server : public ACE_Oneshot_Acceptor<Svc_Handler, ACE_SPIPE_ACCEPTOR>
43 public:
44 IPC_Server ();
45 ~IPC_Server ();
47 // = Dynamic linking hooks.
48 virtual int init (int argc, ACE_TCHAR *argv[]);
49 // Initialize the network server.
51 virtual int fini ();
52 // Close down the server.
54 virtual int svc ();
55 // Run the interative service.
57 private:
58 int parse_args (int argc, ACE_TCHAR *argv[]);
59 // Parse command-line arguments.
61 int n_threads_;
62 // Size of thread pool to use.
64 ACE_TCHAR rendezvous_[MAXPATHLEN + 1];
65 // Meeting place for pipe.
67 int shutdown_;
68 // Keeps track of when we shut down due to receipt of the SIGINT
69 // signal.
71 int handle_signal (int signum, siginfo_t *, ucontext_t *);
72 // Signal handler method.
75 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
76 #endif /* SP_ACCEPTOR_H */