diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-06-21 21:18:43 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-06-21 21:18:43 +0000 |
commit | 4a64648a3f05d15cfffb693e24c76997d6a58423 (patch) | |
tree | d63d31d06a4549605f6a85d9719e1f84b2bd2e29 | |
parent | f9438cf147b2b788b151f522cefe526d1a8e67c4 (diff) | |
download | ATCD-4a64648a3f05d15cfffb693e24c76997d6a58423.tar.gz |
*** empty log message ***
30 files changed, 582 insertions, 168 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index b97db7bc7e4..aeca1eb0c58 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,5 +1,59 @@ Sat Jun 21 10:48:34 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + * examples/Reactor/FIFO: Added a new example that illustrates + how the Reactor and the FIFO wrappers work together. Thanks + to Johannes Gutleber <Johannes.Gutleber@cern.ch> for sending + this. + + * tests/Time_Service_Test.cpp (main): Replaced the kill() call + with the terminate() call since kill() isn't portable across + platforms. + + * ace/Process: The kill() method on this class was being used + incorrectly. I've created a new method called terminate() that + terminates the process. + + * ace/Process_Manager: Renamed the kill() method to terminate() + and updated the implementation to use the new + ACE::terminate_process() call. + + * ace/ACE: Moved the incorrect Win32 and Chorus implementations of + ACE_OS::kill() and put them in a new static method called + ACE::terminate_process(). + + * ace/ACE: Changed the name of the is_process_active() to the + more concise process_active(). + + * ace/OS.i: Added an implementation of ACE_OS::kill() for Chorus. + Note that this doesn't behave as UNIX does -- it kills the + process id rather than sending a signal! Thanks to Wei Chiang + <chiang@tele.nokia.fi> for these fixes. + + * examples/Reactor/Misc/notification.cpp: Added patches to run + this example under Chorus. Thanks to Wei Chiang + <chiang@tele.nokia.fi> for these fixes. + + * ace/Connector.cpp (create_AST): Changed the order of some + instructions in Connector::create_AST method to make it more + safer to use in multi-thread environment. Thank to Paul Han + <phan@CCGATE.HAC.COM> for reporting the problem and the fix. + + * ace/Connector.cpp (create_AST): Make sure to pass in the "mask" + when calling remove_handler() so that we get the right set of + bits removed from the Reactor. + + * tests/Reactor_Timer_Test.cpp (class Time_Handler): Changed int + to long to avoid type conversion problems on 64 bit SGI. Thanks + to Fred LaBar <flabar@fallschurch.esys.com> for reporting this. + + * examples/Reactor/FIFO: Added a test program to illustrate the + interaction of the ACE Reactor with the FIFO IPC mechanism. + Thanks to Johannes Gutleber <Johannes.Gutleber@cern.ch> for this + test. + + * examples/Reactor/Misc/pingpong.cpp: Added support for Chorus. + Thanks to Wei Chiang <chiang@tele.nokia.fi> for this. + * ace: Added a number of minor changes to signal assignment code so that ACE will compile with Tandem NonStop. Thanks to Jan Perman <uabjjpp@osd.ericsson.se> for these fixes. @@ -517,6 +517,7 @@ Jan Perman <uabjjpp@osd.ericsson.se> Shankar Krishnamoorthy <kshankar@lucent.com> Reza Roodsari <reza@sprynet.com> Jim Crossley <jim@lads.com> +Johannes Gutleber <Johannes.Gutleber@cern.ch> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson and is now at ObjectSpace. Paul devised the recursive diff --git a/ace/ACE.cpp b/ace/ACE.cpp index a51d3faf85f..03e05abf9d4 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -11,35 +11,57 @@ #include "ace/Auto_Ptr.h" #include "ace/INET_Addr.h" -// TESTING ADDITION -// This is needed for AIX 3.2.5 -#if defined(_AIX) -#include /**/ <sys/ioctl.h> -#endif -#if defined(__sun__) && !defined(_SVR4) -#include /**/ <sys/sockio.h> -#endif -// END TESTING ADDITION - // Size of a VM page. size_t ACE::pagesize_ = 0; int -ACE::is_process_active (pid_t pid) +ACE::terminate_process (pid_t pid) +{ +#if defined (ACE_WIN32) + ACE_UNUSED_ARG (signum); + + // Create a handle for the given process id. + ACE_HANDLE process_handle = + ::OpenProcess (PROCESS_TERMINATE, + FALSE, // New handle is not inheritable. + pid); + + if (process_handle == ACE_INVALID_HANDLE || process_handle == NULL) + return -1; + else + { + // Kill the process associated with process_handle. + BOOL terminate_result = ::TerminateProcess (process_handle, 0); + // Free up the kernel resources. + ACE_OS::close (process_handle); + return terminate_result; + } +#elif defined (CHORUS) + ACE_UNUSED_ARG (signum); + KnCap cap_; + + // Use the pid to find out the actor's capability, then kill it. + if (::acap (AM_MYSITE, pid, &cap_) == 0) + ACE_OSCALL_RETURN (::akill (&cap_), int, -1); + else + return -1; +#else + ACE_OSCALL_RETURN (::kill (pid, 9), int, -1); +#endif /* ACE_WIN32 */ +} + +int +ACE::process_active (pid_t pid) { #if !defined(ACE_WIN32) int retval = ACE_OS::kill (pid, 0); + if (retval == 0) - { - return 1; - } + return 1; + else if (errno == ESRCH) + return 0; else - { - if (errno == ESRCH) - return 0; - else - return retval; - } + return -1; #else // Create a handle for the given process id. ACE_HANDLE process_handle = ::OpenProcess (PROCESS_QUERY_INFORMATION, @@ -53,15 +75,11 @@ ACE::is_process_active (pid_t pid) DWORD status; if (::GetExitCodeProcess (process_handle, - &status) == 0) + &status) == 0 + || status != STILL_ACTIVE) return 0; else - { - if (status == STILL_ACTIVE) - return 1; - else - return 0; - } + return 1; } #endif /* ACE_WIN32 */ } diff --git a/ace/ACE.h b/ace/ACE.h index 0fa913d4b3d..eedf79a35c3 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -387,8 +387,15 @@ public: // Returns a string containing the error message corresponding to a // WinSock error. This works around an omission in the Win32 API... - static is_process_active (pid_t pid); - // Checks if process with <pid> is still alive + static int process_active (pid_t pid); + // Checks if process with <pid> is still alive. Returns 1 if it is + // still alive, 0 if it isn't alive, and -1 if something weird + // happened. + + static int terminate_process (pid_t pid); + // Terminate the process with id <pid>. Note that this call is + // potentially dangerous to use since the process being terminated + // may not have a chance to cleanup before it shuts down. private: ACE (void); diff --git a/ace/Connector.cpp b/ace/Connector.cpp index 37426b6742a..18514f72494 100644 --- a/ace/Connector.cpp +++ b/ace/Connector.cpp @@ -426,15 +426,15 @@ ACE_Connector<SH, PR_CO_2>::create_AST (SH *sh, ACE_Reactor_Mask mask = ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK; #if defined (ACE_WIN32) + // Win32 has some screwy semantics here... mask |= ACE_Event_Handler::EXCEPT_MASK; #endif /* ACE_WIN32 */ - if (this->reactor ()->register_handler (this, - mask) == -1) + // Bind ACE_Svc_Tuple with the ACE_HANDLE we're trying to connect. + if (this->handler_map_.bind (this->get_handle (), ast) == -1) goto fail1; - // Bind ACE_Svc_Tuple with the ACE_HANDLE we're trying to connect. - else if (this->handler_map_.bind (this->get_handle (), ast) == -1) + else if (this->reactor ()->register_handler (this, mask) == -1) goto fail2; // If we're starting connection under timer control then we need to // schedule a timeout with the ACE_Reactor. @@ -468,13 +468,11 @@ ACE_Connector<SH, PR_CO_2>::create_AST (SH *sh, // Undo previous actions using the ol' "goto label and fallthru" // trick... fail3: - this->handler_map_.unbind (this->get_handle ()); + this->reactor ()->remove_handler (this, + mask | ACE_Event_Handler::DONT_CALL); /* FALLTHRU */ fail2: - this->reactor ()->remove_handler (this, - ACE_Event_Handler::READ_MASK - | ACE_Event_Handler::WRITE_MASK - | ACE_Event_Handler::DONT_CALL); + this->handler_map_.unbind (this->get_handle ()); /* FALLTHRU */ fail1: diff --git a/ace/FIFO_Recv.cpp b/ace/FIFO_Recv.cpp index 3add4e66072..acf85b81058 100644 --- a/ace/FIFO_Recv.cpp +++ b/ace/FIFO_Recv.cpp @@ -23,6 +23,7 @@ ACE_FIFO_Recv::close (void) { ACE_TRACE ("ACE_FIFO_Recv::close"); int result = ACE_FIFO::close (); + if (this->aux_handle_ != ACE_INVALID_HANDLE) return ACE_OS::close (this->aux_handle_); else @@ -34,29 +35,41 @@ ACE_FIFO_Recv::close (void) // aren't any writers at the moment! int -ACE_FIFO_Recv::open (const char *fifo_name, int flags, int perms, int persistent) +ACE_FIFO_Recv::open (const char *fifo_name, + int flags, + int perms, + int persistent) { ACE_TRACE ("ACE_FIFO_Recv::open"); + if (ACE_FIFO::open (fifo_name, ACE_NONBLOCK | flags, perms) == -1) return -1; else if (this->disable (ACE_NONBLOCK) == -1) return -1; - else if (persistent && (this->aux_handle_ = - ACE_OS::open (fifo_name, O_WRONLY)) == ACE_INVALID_HANDLE) + else if (persistent + && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY)) == ACE_INVALID_HANDLE) return -1; else return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; } -ACE_FIFO_Recv::ACE_FIFO_Recv (void): aux_handle_ (ACE_INVALID_HANDLE) +ACE_FIFO_Recv::ACE_FIFO_Recv (void) + : aux_handle_ (ACE_INVALID_HANDLE) { ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); } -ACE_FIFO_Recv::ACE_FIFO_Recv (const char *fifo_name, int flags, int perms, int persistent) +ACE_FIFO_Recv::ACE_FIFO_Recv (const char *fifo_name, + int flags, + int perms, + int persistent) { ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); - if (this->ACE_FIFO_Recv::open (fifo_name, flags, perms, persistent) == -1) + + if (this->ACE_FIFO_Recv::open (fifo_name, + flags, + perms, + persistent) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Recv")); } diff --git a/ace/FIFO_Recv.h b/ace/FIFO_Recv.h index 7d6b929663e..923b2644725 100644 --- a/ace/FIFO_Recv.h +++ b/ace/FIFO_Recv.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY diff --git a/ace/FIFO_Recv_Msg.cpp b/ace/FIFO_Recv_Msg.cpp index f2712048c08..879df61cb8e 100644 --- a/ace/FIFO_Recv_Msg.cpp +++ b/ace/FIFO_Recv_Msg.cpp @@ -15,15 +15,22 @@ ACE_FIFO_Recv_Msg::dump (void) const ACE_FIFO_Recv::dump (); } -/* Note that persistent means "open fifo for writing, as well as reading." - This ensures that the fifo never gets EOF, even if there aren't - any writers at the moment! */ +// Note that persistent means "open FIFO for writing, as well as +// reading." This ensures that the FIFO never gets EOF, even if there +// aren't any writers at the moment! int -ACE_FIFO_Recv_Msg::open (const char *fifo_name, int flags, int perms, int persistent) +ACE_FIFO_Recv_Msg::open (const char *fifo_name, + int flags, + int perms, + int persistent) { ACE_TRACE ("ACE_FIFO_Recv_Msg::open"); - return ACE_FIFO_Recv::open (fifo_name, flags, perms, persistent); + + return ACE_FIFO_Recv::open (fifo_name, + flags, + perms, + persistent); } ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void) @@ -31,10 +38,16 @@ ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void) ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); } -ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const char *fifo_name, int flags, int perms, int persistent) +ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const char *fifo_name, + int flags, + int perms, + int persistent) { ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); - if (this->ACE_FIFO_Recv_Msg::open (fifo_name, flags, perms, - persistent) == -1) + + if (this->ACE_FIFO_Recv_Msg::open (fifo_name, + flags, + perms, + persistent) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "ACE_FIFO_Recv_Msg")); } diff --git a/ace/FIFO_Recv_Msg.h b/ace/FIFO_Recv_Msg.h index dcafa989ac6..ad6418c26d6 100644 --- a/ace/FIFO_Recv_Msg.h +++ b/ace/FIFO_Recv_Msg.h @@ -1,7 +1,6 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = LIBRARY @@ -36,9 +35,9 @@ public: // Open up a record-oriented named pipe for reading. int open (const char *rendezvous, - int flags = O_CREAT | O_RDONLY, - int perms = ACE_DEFAULT_FILE_PERMS, - int persistent = 1); + int flags = O_CREAT | O_RDONLY, + int perms = ACE_DEFAULT_FILE_PERMS, + int persistent = 1); // Open up a record-oriented named pipe for reading. ssize_t recv (ACE_Str_Buf &msg); diff --git a/ace/FIFO_Recv_Msg.i b/ace/FIFO_Recv_Msg.i index 7ee7f74ee10..8d4544f3272 100644 --- a/ace/FIFO_Recv_Msg.i +++ b/ace/FIFO_Recv_Msg.i @@ -13,7 +13,10 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); #if defined (ACE_HAS_STREAM_PIPES) int i = 0; - return ACE_OS::getmsg (this->get_handle (), (strbuf *) 0, (strbuf *) &recv_msg, &i); + return ACE_OS::getmsg (this->get_handle (), + (strbuf *) 0, + (strbuf *) &recv_msg, + &i); #else /* Do the ol' 2-read trick... */ if (ACE_OS::read (this->get_handle (), (char *) &recv_msg.len, @@ -37,19 +40,28 @@ ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len) #if defined (ACE_HAS_STREAM_PIPES) inline ssize_t -ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, ACE_Str_Buf *cntl, int *flags) +ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags) { ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); return ACE_OS::getmsg (this->get_handle (), - (strbuf *) cntl, (strbuf *) data, flags); + (strbuf *) cntl, + (strbuf *) data, + flags); } inline ssize_t -ACE_FIFO_Recv_Msg::recv (int *band, ACE_Str_Buf *data, ACE_Str_Buf *cntl, int *flags) +ACE_FIFO_Recv_Msg::recv (int *band, + ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags) { ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); return ACE_OS::getpmsg (this->get_handle (), - (strbuf *) cntl, (strbuf *) data, band, flags); + (strbuf *) cntl, + (strbuf *) data, + band, + flags); } - #endif /* ACE_HAS_STREAM_PIPES */ diff --git a/ace/Message_Block.h b/ace/Message_Block.h index 63b7dc6288c..214b6c5ba1b 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -240,7 +240,8 @@ public: void wr_ptr (char *ptr); // Set the write pointer to <ptr>. void wr_ptr (size_t n); - // Set the write pointer ahead <n> bytes. + // Set the write pointer ahead <n> bytes. This is used to compute + // the <length> of a message. // = Message length is wr_ptr() - rd_ptr (). size_t length (void) const; @@ -2107,6 +2107,7 @@ extern "C" { #include /**/ <sys/uio.h> #include /**/ <time.h> #include /**/ <stdfileio.h> +#include /**/ <am/afexec.h> // This must come after limits.h is included #define MAXPATHLEN _POSIX_PATH_MAX @@ -6448,25 +6448,8 @@ ACE_INLINE int ACE_OS::kill (pid_t pid, int signum) { // ACE_TRACE ("ACE_OS::kill"); -#if defined (ACE_WIN32) - ACE_UNUSED_ARG (signum); - - // Create a handle for the given process id. - ACE_HANDLE process_handle = - ::OpenProcess (PROCESS_TERMINATE, - FALSE, // New handle is not inheritable. - pid); - - if (process_handle == ACE_INVALID_HANDLE || process_handle == NULL) - return -1; - else - { - // Kill the process associated with process_handle. - BOOL terminate_result = ::TerminateProcess (process_handle, 0); - // Free up the kernel resources. - ACE_OS::close (process_handle); - return terminate_result; - } +#if defined (ACE_WIN32) || defined (CHORUS) + ACE_NOTSUP_RETURN (-1); #else ACE_OSCALL_RETURN (::kill (pid, signum), int, -1); #endif /* ACE_WIN32 */ diff --git a/ace/Process.h b/ace/Process.h index df4840cfd3a..2f67b89b32a 100644 --- a/ace/Process.h +++ b/ace/Process.h @@ -20,12 +20,12 @@ #include "ace/OS.h" class ACE_Export ACE_Process_Options -// = TITLE -// Process Options -// -// = DESCRIPTION -// This class controls the options passed to CreateProcess (or fork -// and exec). + // = TITLE + // Process Options + // + // = DESCRIPTION + // This class controls the options passed to <CreateProcess> (or <fork> + // and <exec>). { public: enum { DEFAULT_COMMAND_LINE_BUF_LEN = 1024 }; @@ -229,11 +229,11 @@ protected: // ************************************************************ class ACE_Export ACE_Process -// = TITLE -// Process -// -// = DESCRIPTION -// A Portable encapsulation for creating new processes. + // = TITLE + // Process + // + // = DESCRIPTION + // A Portable encapsulation for creating new processes. { public: ACE_Process (void); @@ -252,7 +252,12 @@ public: // Timed wait for the process we just created to exit. int kill (int signum = SIGINT); - // Send the process a signal. + // Send the process a signal. This is only portable to operating + // systems that support signals (e.g., POSIX). + + int terminate (void); + // Terminate the process. This call doesn't give the process a + // chance to cleanup, so use with caution... pid_t getpid (void); // Return the pid of the new process. @@ -268,19 +273,18 @@ protected: pid_t child_id_; // Process id of the child. #endif /* ACE_WIN32 */ - }; // ************************************************************ class ACE_Export ACE_Tokenizer -// = TITLE -// Tokenizer -// -// = DESCRIPTION -// Tokenizes a buffer. Allows application to set delimiters and -// preserve designators. Does not allow special characters, yet -// (e.g., printf ("\"like a quoted string\""). + // = TITLE + // Tokenizer + // + // = DESCRIPTION + // Tokenizes a buffer. Allows application to set delimiters and + // preserve designators. Does not allow special characters, yet + // (e.g., printf ("\"like a quoted string\""). { public: ACE_Tokenizer (LPTSTR buffer); diff --git a/ace/Process.i b/ace/Process.i index b52c2ef03d9..a2e94aa77af 100644 --- a/ace/Process.i +++ b/ace/Process.i @@ -23,14 +23,20 @@ ACE_Process::getpid (void) ACE_INLINE int ACE_Process::kill (int signum) { -#if defined (ACE_WIN32) +#if defined (ACE_WIN32) || defined (CHORUS) ACE_UNUSED_ARG (signum); - return (int) ::TerminateProcess (this->process_info_.hProcess, 0); + ACE_NOTSUP_RETURN (-1); #else return ACE_OS::kill (this->getpid (), signum); #endif /* ACE_WIN32 */ } +ACE_INLINE int +ACE_Process::terminate (void) +{ + return ACE::terminate_process (this->getpid ()); +} + // ************************************************************ #if defined (ACE_WIN32) diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp index 9c7647d000c..33bcee42c95 100644 --- a/ace/Process_Manager.cpp +++ b/ace/Process_Manager.cpp @@ -246,9 +246,9 @@ ACE_Process_Manager::remove (pid_t pid) } int -ACE_Process_Manager::kill (pid_t pid, int signum) +ACE_Process_Manager::terminate (pid_t pid) { - ACE_TRACE ("ACE_Process_Manager::kill_proc"); + ACE_TRACE ("ACE_Process_Manager::terminate"); // Check for duplicates and bail out if they're already // registered... @@ -258,8 +258,7 @@ ACE_Process_Manager::kill (pid_t pid, int signum) return -1; else { - int result = ACE_OS::kill (this->proc_table_[i].proc_id_, - signum); + int result = ACE::terminate_process (this->proc_table_[i].proc_id_); if (result == -1) { diff --git a/ace/Process_Manager.h b/ace/Process_Manager.h index ce58be467fd..a16abbb3eac 100644 --- a/ace/Process_Manager.h +++ b/ace/Process_Manager.h @@ -79,8 +79,8 @@ public: // Block until there are no more processs running or <timeout> // expires. Returns 0 on success and -1 on failure. - int kill (pid_t, int signum); - // Kill a single process. + int terminate (pid_t pid); + // Terminate a single process with id <pid>. int remove (pid_t pid); // Remove process <pid> from the table. This is typically called by diff --git a/ace/Signal.i b/ace/Signal.i index cc73b80f8aa..cc5435a6637 100644 --- a/ace/Signal.i +++ b/ace/Signal.i @@ -109,9 +109,9 @@ ACE_Sig_Action::handler (ACE_SignalHandler handler) { ACE_TRACE ("ACE_Sig_Action::handler"); #if !defined(ACE_HAS_TANDEM_SIGNALS) - this->sa_.sa_handler = ACE_SignalHandlerV (sig_handler); + this->sa_.sa_handler = ACE_SignalHandlerV (handler); #else - this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (sig_handler); + this->sa_.sa_handler = (void (*)()) ACE_SignalHandlerV (handler); #endif /* !ACE_HAS_TANDEM_SIGNALS */ } diff --git a/examples/ASX/Message_Queue/Makefile b/examples/ASX/Message_Queue/Makefile index f76ef41a74a..1c2146c05bd 100644 --- a/examples/ASX/Message_Queue/Makefile +++ b/examples/ASX/Message_Queue/Makefile @@ -11,7 +11,7 @@ BIN = buffer_stream \ bounded_buffer \ priority_buffer - + VLDLIBS = $(LDLIBS:%=%$(VAR)) BUILD = $(VBIN) diff --git a/examples/IPC_SAP/FIFO_SAP/FIFO-test.cpp b/examples/IPC_SAP/FIFO_SAP/FIFO-test.cpp index 0e7004584ee..9d54e0d00bf 100644 --- a/examples/IPC_SAP/FIFO_SAP/FIFO-test.cpp +++ b/examples/IPC_SAP/FIFO_SAP/FIFO-test.cpp @@ -6,7 +6,6 @@ // the fifo. The child reads from the ACE_FIFO and executes the more // command. - #include "ace/FIFO_Recv.h" #include "ace/FIFO_Send.h" @@ -14,9 +13,9 @@ #define EXEC_NAME "more" #define EXEC_COMMAND_ARG "more" -const char *FIFO_NAME = "/tmp/fifo"; +static const char *FIFO_NAME = "/tmp/fifo"; -int +static int do_child (ACE_FIFO_Recv &fifo_reader) { // Set child's stdin to read from the fifo. @@ -32,13 +31,14 @@ do_child (ACE_FIFO_Recv &fifo_reader) return 0; } -int -do_parent (const char fifo_name[], char input_filename[]) +static int +do_parent (const char fifo_name[], + char input_filename[]) { - int inputfd; + int inputfd; ACE_FIFO_Send fifo_sender (fifo_name, O_WRONLY | O_CREAT); - int len; - char buf[BUFSIZ]; + int len; + char buf[BUFSIZ]; if (fifo_sender.get_handle () == ACE_INVALID_HANDLE) return -1; diff --git a/examples/Reactor/FIFO/Makefile b/examples/Reactor/FIFO/Makefile new file mode 100644 index 00000000000..9de645b2846 --- /dev/null +++ b/examples/Reactor/FIFO/Makefile @@ -0,0 +1,171 @@ +#---------------------------------------------------------------------------- +# @(#)Makefile 1.1 10/18/96 +# +# Makefile for testing the Reactor and FIFOs +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +BIN = client \ + server + +LSRC = $(addsuffix .cpp,$(BIN)) + +VLDLIBS = $(LDLIBS:%=%$(VAR)) + +BUILD = $(VBIN) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU +include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +.obj/client.o .shobj/client.so: client.cpp \ + $(WRAPPER_ROOT)/ace/FIFO_Send_Msg.h \ + $(WRAPPER_ROOT)/ace/FIFO_Send.h \ + $(WRAPPER_ROOT)/ace/FIFO.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/stdcpp.h \ + $(WRAPPER_ROOT)/ace/OS.i \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/IPC_SAP.i \ + $(WRAPPER_ROOT)/ace/FIFO.i \ + $(WRAPPER_ROOT)/ace/FIFO_Send.i \ + $(WRAPPER_ROOT)/ace/FIFO_Send_Msg.i +.obj/server.o .shobj/server.so: server.cpp \ + $(WRAPPER_ROOT)/ace/Service_Config.h \ + $(WRAPPER_ROOT)/ace/Service_Object.h \ + $(WRAPPER_ROOT)/ace/Shared_Object.h \ + $(WRAPPER_ROOT)/ace/ACE.h \ + $(WRAPPER_ROOT)/ace/OS.h \ + $(WRAPPER_ROOT)/ace/config.h \ + $(WRAPPER_ROOT)/ace/stdcpp.h \ + $(WRAPPER_ROOT)/ace/OS.i \ + $(WRAPPER_ROOT)/ace/Trace.h \ + $(WRAPPER_ROOT)/ace/Log_Msg.h \ + $(WRAPPER_ROOT)/ace/Log_Record.h \ + $(WRAPPER_ROOT)/ace/Log_Priority.h \ + $(WRAPPER_ROOT)/ace/Log_Record.i \ + $(WRAPPER_ROOT)/ace/ACE.i \ + $(WRAPPER_ROOT)/ace/Shared_Object.i \ + $(WRAPPER_ROOT)/ace/Event_Handler.h \ + $(WRAPPER_ROOT)/ace/Event_Handler.i \ + $(WRAPPER_ROOT)/ace/Service_Object.i \ + $(WRAPPER_ROOT)/ace/Thread_Manager.h \ + $(WRAPPER_ROOT)/ace/Thread.h \ + $(WRAPPER_ROOT)/ace/Thread.i \ + $(WRAPPER_ROOT)/ace/Synch.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \ + $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \ + $(WRAPPER_ROOT)/ace/Synch.i \ + $(WRAPPER_ROOT)/ace/Synch_T.h \ + $(WRAPPER_ROOT)/ace/Synch_T.i \ + $(WRAPPER_ROOT)/ace/Synch_T.cpp \ + $(WRAPPER_ROOT)/ace/Thread_Manager.i \ + $(WRAPPER_ROOT)/ace/Signal.h \ + $(WRAPPER_ROOT)/ace/Containers.h \ + $(WRAPPER_ROOT)/ace/Containers.i \ + $(WRAPPER_ROOT)/ace/Containers.cpp \ + $(WRAPPER_ROOT)/ace/Signal.i \ + $(WRAPPER_ROOT)/ace/Service_Config.i \ + $(WRAPPER_ROOT)/ace/Reactor.h \ + $(WRAPPER_ROOT)/ace/Handle_Set.h \ + $(WRAPPER_ROOT)/ace/Handle_Set.i \ + $(WRAPPER_ROOT)/ace/Timer_Queue.h \ + $(WRAPPER_ROOT)/ace/Timer_Queue_T.h \ + $(WRAPPER_ROOT)/ace/Time_Value.h \ + $(WRAPPER_ROOT)/ace/Free_List.h \ + $(WRAPPER_ROOT)/ace/Free_List.i \ + $(WRAPPER_ROOT)/ace/Free_List.cpp \ + $(WRAPPER_ROOT)/ace/Timer_Queue_T.i \ + $(WRAPPER_ROOT)/ace/Timer_Queue_T.cpp \ + $(WRAPPER_ROOT)/ace/Token.h \ + $(WRAPPER_ROOT)/ace/Pipe.h \ + $(WRAPPER_ROOT)/ace/Pipe.i \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.h \ + $(WRAPPER_ROOT)/ace/SOCK_IO.h \ + $(WRAPPER_ROOT)/ace/SOCK.h \ + $(WRAPPER_ROOT)/ace/Addr.h \ + $(WRAPPER_ROOT)/ace/Addr.i \ + $(WRAPPER_ROOT)/ace/IPC_SAP.h \ + $(WRAPPER_ROOT)/ace/IPC_SAP.i \ + $(WRAPPER_ROOT)/ace/SOCK.i \ + $(WRAPPER_ROOT)/ace/SOCK_IO.i \ + $(WRAPPER_ROOT)/ace/INET_Addr.h \ + $(WRAPPER_ROOT)/ace/INET_Addr.i \ + $(WRAPPER_ROOT)/ace/SOCK_Stream.i \ + $(WRAPPER_ROOT)/ace/Reactor.i \ + $(WRAPPER_ROOT)/ace/Proactor.h \ + $(WRAPPER_ROOT)/ace/Asynch_IO.h \ + $(WRAPPER_ROOT)/ace/Timer_List.h \ + $(WRAPPER_ROOT)/ace/Timer_List_T.h \ + $(WRAPPER_ROOT)/ace/Timer_List_T.cpp \ + $(WRAPPER_ROOT)/ace/Timer_Heap.h \ + $(WRAPPER_ROOT)/ace/Timer_Heap_T.h \ + $(WRAPPER_ROOT)/ace/Timer_Heap_T.cpp \ + $(WRAPPER_ROOT)/ace/Timer_Wheel.h \ + $(WRAPPER_ROOT)/ace/Timer_Wheel_T.h \ + $(WRAPPER_ROOT)/ace/Timer_Wheel_T.cpp \ + $(WRAPPER_ROOT)/ace/High_Res_Timer.h \ + $(WRAPPER_ROOT)/ace/High_Res_Timer.i \ + $(WRAPPER_ROOT)/ace/ReactorEx.h \ + $(WRAPPER_ROOT)/ace/Message_Queue.h \ + $(WRAPPER_ROOT)/ace/Message_Block.h \ + $(WRAPPER_ROOT)/ace/Malloc.h \ + $(WRAPPER_ROOT)/ace/Malloc.i \ + $(WRAPPER_ROOT)/ace/Malloc_T.h \ + $(WRAPPER_ROOT)/ace/Malloc_T.i \ + $(WRAPPER_ROOT)/ace/Malloc_T.cpp \ + $(WRAPPER_ROOT)/ace/Memory_Pool.h \ + $(WRAPPER_ROOT)/ace/Mem_Map.h \ + $(WRAPPER_ROOT)/ace/Mem_Map.i \ + $(WRAPPER_ROOT)/ace/Memory_Pool.i \ + $(WRAPPER_ROOT)/ace/Message_Block.i \ + $(WRAPPER_ROOT)/ace/IO_Cntl_Msg.h \ + $(WRAPPER_ROOT)/ace/Strategies.h \ + $(WRAPPER_ROOT)/ace/Strategies_T.h \ + $(WRAPPER_ROOT)/ace/Synch_Options.h \ + $(WRAPPER_ROOT)/ace/Hash_Map_Manager.h \ + $(WRAPPER_ROOT)/ace/Hash_Map_Manager.cpp \ + $(WRAPPER_ROOT)/ace/Strategies_T.cpp \ + $(WRAPPER_ROOT)/ace/Message_Queue.i \ + $(WRAPPER_ROOT)/ace/Message_Queue.cpp \ + $(WRAPPER_ROOT)/ace/ReactorEx.i \ + $(WRAPPER_ROOT)/ace/Svc_Conf_Tokens.h \ + $(WRAPPER_ROOT)/ace/FIFO_Recv_Msg.h \ + $(WRAPPER_ROOT)/ace/FIFO_Recv.h \ + $(WRAPPER_ROOT)/ace/FIFO.h \ + $(WRAPPER_ROOT)/ace/FIFO.i \ + $(WRAPPER_ROOT)/ace/FIFO_Recv.i \ + $(WRAPPER_ROOT)/ace/FIFO_Recv_Msg.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/examples/Reactor/FIFO/client.cpp b/examples/Reactor/FIFO/client.cpp new file mode 100644 index 00000000000..5bee3c8548f --- /dev/null +++ b/examples/Reactor/FIFO/client.cpp @@ -0,0 +1,17 @@ +#include "ace/FIFO_Send_Msg.h" + +int +main (void) +{ + char buf[] = "hello world"; + ACE_Str_Buf msg (buf, sizeof buf); + + ACE_FIFO_Send_Msg fifo_sender (ACE_DEFAULT_RENDEZVOUS, + O_WRONLY | O_CREAT, + ACE_DEFAULT_FILE_PERMS); + + if (fifo_sender.send (&msg) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send error for fifo"), -1); + else + return 0; +} diff --git a/examples/Reactor/FIFO/server.cpp b/examples/Reactor/FIFO/server.cpp new file mode 100644 index 00000000000..59b585d5f7c --- /dev/null +++ b/examples/Reactor/FIFO/server.cpp @@ -0,0 +1,80 @@ +#include "ace/Service_Config.h" +#include "ace/FIFO_Recv_Msg.h" + +class FIFO_Recv_Handler : public ACE_Event_Handler +{ +public: + FIFO_Recv_Handler (void); + ~FIFO_Recv_Handler (void); + + virtual ACE_HANDLE get_handle (void) const; + virtual int handle_input (ACE_HANDLE fd); + +private: + ACE_FIFO_Recv_Msg fifo_reader_; +}; + +FIFO_Recv_Handler::FIFO_Recv_Handler (void) +{ + ACE_OS::unlink (ACE_DEFAULT_RENDEZVOUS); + + // Make sure to open the FIFO with the "persistent" flag enabled + // (which is the default). + if (this->fifo_reader_.open (ACE_DEFAULT_RENDEZVOUS) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", "open")); + + // Register with the Reactor. + if (ACE_Service_Config::reactor ()->register_handler + (this, ACE_Event_Handler::READ_MASK) == -1) + ACE_ERROR ((LM_ERROR, "%p\n", "register_handler")); +} + +ACE_HANDLE +FIFO_Recv_Handler::get_handle (void) const +{ + return this->fifo_reader_.get_handle (); +} + +FIFO_Recv_Handler::~FIFO_Recv_Handler (void) +{ + this->fifo_reader_.close (); + this->fifo_reader_.remove (); +} + +int +FIFO_Recv_Handler::handle_input (ACE_HANDLE) +{ + char buf[BUFSIZ]; + + ACE_DEBUG ((LM_DEBUG, "handle_input\n")); + + ACE_Str_Buf msg (buf, 0, sizeof buf); + + ssize_t n = this->fifo_reader_.recv (msg); + + if (n < 0) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "recv"), -1); + else + { + ACE_DEBUG ((LM_DEBUG, "msg.len = %d, n = %d\n", msg.len, n)); + + if (msg.len > 0) + { + // Do some work in here... + ACE_DEBUG ((LM_DEBUG, "msg.buf = %s\n", msg.buf)); + } + return 0; + } +} + +int +main (int, char *argv[]) +{ + ACE_Service_Config daemon (argv[0]); + + FIFO_Recv_Handler fr_handler; + + ACE_Service_Config::run_reactor_event_loop (); + + return 0; +} diff --git a/examples/Reactor/Makefile b/examples/Reactor/Makefile index 4613709a2a2..b5cd2f404a0 100644 --- a/examples/Reactor/Makefile +++ b/examples/Reactor/Makefile @@ -9,6 +9,7 @@ #---------------------------------------------------------------------------- DIRS = Dgram \ + FIFO \ Misc \ Multicast \ Ntalker diff --git a/examples/Reactor/Misc/notification.cpp b/examples/Reactor/Misc/notification.cpp index 89a75d7b33b..9a5853d1c17 100644 --- a/examples/Reactor/Misc/notification.cpp +++ b/examples/Reactor/Misc/notification.cpp @@ -2,8 +2,15 @@ #include "ace/Service_Config.h" #include "ace/Thread.h" +#include "ace/Synch_T.h" #if defined (ACE_HAS_THREADS) +#if defined (CHORUS) +// Chorus does not have signal, so we'll stop after a number of rounds. +#define MAX_ITERATIONS 3 +#else +#define MAX_ITERATIONS 10000 +#endif class Thread_Handler : public ACE_Event_Handler // = TITLE @@ -49,6 +56,8 @@ private: size_t id_; // ID passed in by Thread_Handler constructor. + int iterations_; + static sig_atomic_t shutdown_; // Shutting down. @@ -69,17 +78,21 @@ ACE_Time_Value Thread_Handler::delay_; // Interval factor for Event_Handler timer. ACE_Time_Value Thread_Handler::interval_; + Thread_Handler::Thread_Handler (int delay, int interval, size_t n_threads) + : iterations_(MAX_ITERATIONS) { delay_.set (delay); interval_.set (interval); +#if !defined(CHORUS) ACE_Sig_Set sig_set; sig_set.sig_add (SIGQUIT); sig_set.sig_add (SIGINT); +#endif this->id_ = 0; @@ -88,8 +101,10 @@ Thread_Handler::Thread_Handler (int delay, ACE_Service_Config::thr_mgr ()) == -1) ACE_ERROR ((LM_ERROR, "%p\n", "register_stdin_handler")); +#if !defined(CHORUS) else if (ACE_Service_Config::reactor ()->register_handler (sig_set, this) == -1) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "register_handler")); +#endif else if (ACE_Service_Config::reactor ()->schedule_timer (this, 0, Thread_Handler::delay_, Thread_Handler::interval_) == -1) @@ -98,7 +113,9 @@ Thread_Handler::Thread_Handler (int delay, // Set up this thread's signal mask, which is inherited by the // threads it spawns. +#if !defined(CHORUS) ACE_Thread::sigsetmask (SIG_BLOCK, sig_set); +#endif // Create N new threads of control Thread_Handlers. @@ -109,7 +126,9 @@ Thread_Handler::Thread_Handler (int delay, ACE_ERROR ((LM_ERROR, "%p\n", "ACE_Thread::spawn")); // Unblock signal set so that only this thread receives them! +#if !defined(CHORUS) ACE_Thread::sigsetmask (SIG_UNBLOCK, sig_set); +#endif } int @@ -120,17 +139,18 @@ Thread_Handler::notify (ACE_Time_Value *timeout) if (ACE_Service_Config::reactor ()->notify (this, ACE_Event_Handler::EXCEPT_MASK, timeout) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "notify"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", + "notification::notify:exception"), -1); else if (ACE_Service_Config::reactor ()->notify (this, ACE_Event_Handler::WRITE_MASK, timeout) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "notify"), -1); + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", + "notification::notify:write"), -1); return 0; } // Test stdin handling (can use select to demultiplex HANDLEs) - +// Input is only handled by the main thread int Thread_Handler::handle_input (ACE_HANDLE handle) { @@ -138,18 +158,31 @@ Thread_Handler::handle_input (ACE_HANDLE handle) ssize_t n = ACE_OS::read (handle, buf, sizeof buf); if (n > 0) - { - ACE_DEBUG ((LM_DEBUG, "(%t) %*s", n, buf)); - - // Only wait up to 10 milliseconds to notify the Reactor. - ACE_Time_Value timeout (0, 10 * 1000); - - if (this->notify (&timeout) == -1) - ACE_ERROR ((LM_DEBUG, "(%t), %p\n", "notify")); + { + ACE_DEBUG ((LM_DEBUG, "input to (%t) %*s", + n, buf)); + + if (--iterations_ <= 0) + { + // would like to put this in handle_timeout(), but chorus + // clock_gettime() does not seem to work in my version! + ACE_Service_Config::end_reactor_event_loop(); + } + else + { + ACE_DEBUG ((LM_DEBUG, "%d more input to kill\n", + iterations_)); + // Only wait up to 10 milliseconds to notify the Reactor. + ACE_Time_Value timeout (0, 10 * 1000); + + if (this->notify (&timeout) == -1) + ACE_ERROR ((LM_DEBUG, "(%t), %p\n", + "notification::handle_input:notify")); + } return 0; - } + } else - return -1; + return -1; } // Perform a task that will test the ACE_Reactor's multi-threading @@ -158,7 +191,9 @@ Thread_Handler::handle_input (ACE_HANDLE handle) int Thread_Handler::svc (void) { - while (this->shutdown_ == 0) + iterations_ = MAX_ITERATIONS; + + while (this->shutdown_ == 0 && --iterations_ > 0 ) { if (Thread_Handler::delay_.sec () > 0) // Block for delay_.secs () / 2, then notify the Reactor. @@ -171,6 +206,7 @@ Thread_Handler::svc (void) ACE_ERROR ((LM_ERROR, "(%t) %p\n", "notify")); } + ACE_Service_Config::reactor()->remove_handler(this, ALL_EVENTS_MASK); ACE_DEBUG ((LM_DEBUG, "(%t) exiting svc\n")); return 0; } @@ -210,7 +246,7 @@ int Thread_Handler::handle_exception (ACE_HANDLE) { ACE_DEBUG ((LM_DEBUG, - "(%t) handle_exception received notification from id %d\n", + "(%t) exception to id %d\n", this->id_)); return 0; } @@ -221,7 +257,7 @@ int Thread_Handler::handle_output (ACE_HANDLE) { ACE_DEBUG ((LM_DEBUG, - "(%t) handle_output received notification from id %d\n", + "(%t) output to id %d\n", this->id_)); return 0; } diff --git a/examples/Reactor/Misc/pingpong.cpp b/examples/Reactor/Misc/pingpong.cpp index e3b1ead8c81..e77ff89ab6d 100644 --- a/examples/Reactor/Misc/pingpong.cpp +++ b/examples/Reactor/Misc/pingpong.cpp @@ -1,6 +1,6 @@ -/* Simple program that illustrates all the features of the ACE_Reactor: // $Id$ +/* Simple program that illustrates many features of the ACE_Reactor: 1. I/O event demultiplexing 2. Signal-based demultiplexing @@ -99,7 +99,7 @@ Ping_Pong::handle_input (ACE_HANDLE) *(int *) (this->buf_ + sizeof (int)), this->buf_ + (2 * sizeof (int)))); #else - ssize_t n = ACE::recv (this->handle_, this->buf_, sizeof this->buf_); + ssize_t n = ACE::recv (this->handle_, this->buf_, this->buflen_); if (n == -1) ACE_ERROR_RETURN ((LM_ERROR, "[%d] %p\n", handle_, "read"), -1); @@ -156,21 +156,6 @@ static char *string_name; // Wait for 10 seconds and then shut down. static const int SHUTDOWN_TIME = 10; -#if defined (ACE_WIN32) -static ACE_Barrier barrier (3); - -static void * -worker (void *arg) -{ - ACE_HANDLE handle = (ACE_HANDLE) arg; - - run_svc (handle); - barrier.wait (); - ACE_DEBUG ((LM_DEBUG, "(%P|%t) %n: shutting down tester\n")); - return 0; -} -#endif /* ACE_WIN32 */ - static void run_svc (ACE_HANDLE handle) { @@ -184,7 +169,9 @@ run_svc (ACE_HANDLE handle) if (reactor.register_handler (&callback, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1 +#if !defined (CHORUS) || reactor.register_handler (SIGINT, &callback) == -1 +#endif /* CHORUS */ || reactor.schedule_timer (&callback, 0, SHUTDOWN_TIME) == -1) ACE_ERROR ((LM_ERROR, "%p\n%a", "reactor", 1)); @@ -195,6 +182,21 @@ run_svc (ACE_HANDLE handle) ACE_ERROR ((LM_ERROR, "%p\n", "handle_events")); } +#if defined (ACE_WIN32) || defined (CHORUS) +static ACE_Barrier barrier (3); + +static void * +worker (void *arg) +{ + ACE_HANDLE handle = (ACE_HANDLE) arg; + + run_svc (handle); + barrier.wait (); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) %n: shutting down tester\n")); + return 0; +} +#endif /* ACE_WIN32 */ + int main (int argc, char *argv[]) { @@ -210,7 +212,7 @@ main (int argc, char *argv[]) // Create a pipe and initialize the handles. ACE_Pipe pipe (handles); -#if defined (ACE_WIN32) +#if defined (ACE_WIN32) || defined (CHORUS) if (ACE_Thread::spawn (ACE_THR_FUNC (worker), (void *) handles[0], THR_DETACHED) == -1 @@ -220,7 +222,6 @@ main (int argc, char *argv[]) ACE_ERROR ((LM_ERROR, "%p\n%a", "spawn", 1)); barrier.wait (); - #else pid_t pid = ACE_OS::fork (argv[0]); diff --git a/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp b/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp index 06d8c724040..79fd3c65331 100644 --- a/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp +++ b/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.cpp @@ -1,7 +1,6 @@ #include "Handle_L_FIFO.h" // $Id$ - #if defined (SunOS4) extern "C" { diff --git a/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i b/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i index 8b667cb6681..860cc2009ed 100644 --- a/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i +++ b/examples/Service_Configurator/IPC-tests/server/Handle_L_FIFO.i @@ -54,8 +54,8 @@ Handle_L_FIFO::init (int argc, char *argv[]) ACE_OS::unlink (rendezvous_fifo); if (this->open (rendezvous_fifo) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); - else if (ACE_Service_Config::reactor ()->register_handler (this, - ACE_Event_Handler::ACCEPT_MASK) == -1) + else if (ACE_Service_Config::reactor ()->register_handler + (this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1); return 0; } @@ -63,7 +63,8 @@ Handle_L_FIFO::init (int argc, char *argv[]) ACE_INLINE int Handle_L_FIFO::fini (void) { - return ACE_Service_Config::reactor ()->remove_handler (this, ACE_Event_Handler::ACCEPT_MASK); + return ACE_Service_Config::reactor ()->remove_handler + (this, ACE_Event_Handler::ACCEPT_MASK); } ACE_INLINE int diff --git a/tests/Reactor_Timer_Test.cpp b/tests/Reactor_Timer_Test.cpp index 4f843c77c37..48d688e1cbc 100644 --- a/tests/Reactor_Timer_Test.cpp +++ b/tests/Reactor_Timer_Test.cpp @@ -34,7 +34,7 @@ public: virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg) { - int current_count = int (arg); + long current_count = long (arg); ACE_ASSERT (current_count == count); ACE_DEBUG ((LM_DEBUG, "%d: Timer #%d timed out at %d!\n", @@ -58,7 +58,7 @@ main (int, char *[]) Time_Handler rt[ACE_MAX_TIMERS]; int t_id[ACE_MAX_TIMERS]; - int i; + long i; for (i = 0; i < ACE_MAX_TIMERS; i++) t_id[i] = reactor.schedule_timer (&rt[i], diff --git a/tests/Time_Service_Test.cpp b/tests/Time_Service_Test.cpp index dd9a689d291..8c8497a22db 100644 --- a/tests/Time_Service_Test.cpp +++ b/tests/Time_Service_Test.cpp @@ -68,11 +68,11 @@ main (int, char *[]) ACE_DEBUG ((LM_DEBUG, "Sleeping...\n")); ACE_OS::sleep (10); - if (clerk.kill () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Kill failed for clerk.\n"), -1); + if (clerk.terminate () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "Terminate failed for clerk.\n"), -1); - if (server.kill () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "Kill failed for server.\n"), -1); + if (server.terminate () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "Terminate failed for server.\n"), -1); // Since we kill the clerk process, on Win32 it may not do a // graceful shutdown and the backing store file is left behind. |