diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-08-30 01:38:47 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-08-30 01:38:47 +0000 |
commit | 6c5c6d1716b472a95790423458aa42ab18557789 (patch) | |
tree | 1cfafdf9fa8bb7292806aeee4fd4f2d8cd38f940 | |
parent | c6a1ab043dc5bc713e30515cb5cdf50453d07065 (diff) | |
download | ATCD-6c5c6d1716b472a95790423458aa42ab18557789.tar.gz |
ChangeLogTag:Sun Aug 29 07:53:33 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r-- | ChangeLog-99b | 10 | ||||
-rw-r--r-- | ace/OS.h | 1 | ||||
-rw-r--r-- | ace/OS.i | 11 | ||||
-rw-r--r-- | ace/config-linux-common.h | 2 | ||||
-rw-r--r-- | ace/config-sunos5.5.h | 1 | ||||
-rw-r--r-- | tests/Process_Manager_Test.cpp | 18 | ||||
-rw-r--r-- | tests/Signal_Test.cpp | 38 |
7 files changed, 44 insertions, 37 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index fd6070d085a..0575af3767b 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,5 +1,11 @@ Sun Aug 29 07:53:33 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + * ace/OS: Added a new sigpause() wrapper to class ACE_OS. + + * ace/config-sunos5.5.h, + * ace/config-linux-common.h: Added support for + the ACE_HAS_SIGTIMEDWAIT and ACE_HAS_SIGPAUSE macros. + * ace/Signal: Make the use of ACE_Sig_Set & parameters const-correct. @@ -76,10 +82,6 @@ Sun Aug 29 07:53:33 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> the encapsulation uses an ACE_Time_Value, rather than a struct timespec. - * ace/config-sunos5.5.h, - * ace/config-linux-common.h: Added support for - the ACE_HAS_SIGTIMEDWAIT macro. - * ace/config-linux-pthread.h, * ace/config-linux-lxpthreads.h: Removed the @@ -6005,6 +6005,7 @@ public: int signum); static ACE_SignalHandler signal (int signum, ACE_SignalHandler); + static int sigpause (int signum); static int sigprocmask (int how, const sigset_t *nsp, sigset_t *osp); @@ -11674,6 +11674,17 @@ ACE_OS::sigismember (sigset_t *s, int signum) } ACE_INLINE int +ACE_OS::sigpause (int signum) +{ +#if defined (ACE_HAS_SIGPAUSE) + ACE_OSCALL_RETURN (::sigpause (signum), int, -1); +#else + ACE_UNUSED_ARG (signum); + ACE_NOTSUP_RETURN (-1); +#endif /* ACE_HAS_SIGPAUSE */ +} + +ACE_INLINE int ACE_OS::sigprocmask (int how, const sigset_t *nsp, sigset_t *osp) { #if defined (ACE_LACKS_SIGSET) || defined (ACE_LACKS_SIGSET_DEFINITIONS) diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h index 3c44793d426..a661cfda5dc 100644 --- a/ace/config-linux-common.h +++ b/ace/config-linux-common.h @@ -96,7 +96,9 @@ // Platform/compiler has the sigwait(2) prototype # define ACE_HAS_SIGWAIT + # define ACE_HAS_SIGTIMEDWAIT +# define ACE_HAS_SIGPAUSE #if !defined (ACE_DEFAULT_BASE_ADDR) # define ACE_DEFAULT_BASE_ADDR ((char *) 0x80000000) diff --git a/ace/config-sunos5.5.h b/ace/config-sunos5.5.h index 1cb33f0d61f..68c09cb2b0d 100644 --- a/ace/config-sunos5.5.h +++ b/ace/config-sunos5.5.h @@ -270,6 +270,7 @@ # define ACE_HAS_ONLY_SCHED_OTHER # define ACE_HAS_SIGWAIT # define ACE_HAS_SIGTIMEDWAIT +# define ACE_HAS_SIGPAUSE // Compiler/platform has thread-specific storage # define ACE_HAS_THREAD_SPECIFIC_STORAGE diff --git a/tests/Process_Manager_Test.cpp b/tests/Process_Manager_Test.cpp index 7ec9726301e..0b55bcee008 100644 --- a/tests/Process_Manager_Test.cpp +++ b/tests/Process_Manager_Test.cpp @@ -125,8 +125,11 @@ one_child_sig_handler (void *) // This method simply "reaps" the exit status of the // child without blocking. Note that it also decrements // the count of waiting children by one. - pid_t pid = ACE_Process_Manager::instance ()->wait - (-1, &child_exit_status, WNOHANG); + pid_t pid = + ACE_Process_Manager::instance ()->wait + (-1, + &child_exit_status, + WNOHANG); // Check to see if there are anymore children to reap. if (pid == -1) break; @@ -438,13 +441,6 @@ one_child_worker_parent (void *) return 0; } -extern "C" void -exithook (void) -{ - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%P|%t) I'm outta here...\n"))); -} - // Parse the command-line arguments and set options. static void @@ -490,10 +486,6 @@ main (int argc, ASYS_TCHAR *argv[]) ACE_APPEND_LOG (ASYS_TEXT ("Process_Manager_Test-children")); parse_args (argc, argv); - // Register an exit hook so that we can tell when the child process - // exits. - ACE_OS::atexit (exithook); - if (child_test == ACE_TEST_ONE_CHILD) run_test (one_child_sig_handler, one_child_worker_child); diff --git a/tests/Signal_Test.cpp b/tests/Signal_Test.cpp index 578e6b5d4bd..6a8f402bfdb 100644 --- a/tests/Signal_Test.cpp +++ b/tests/Signal_Test.cpp @@ -25,7 +25,7 @@ ACE_RCSID(tests, Signal_Test, "$Id$") -#if !defined (ACE_LACKS_FORK) +#if !defined (ACE_LACKS_FORK) && !defined (ACE_LACKS_UNIX_SIGNALS) // Global options. static size_t n_iterations = 100000; @@ -71,7 +71,9 @@ handle_signal (int signum) // This method simply "reaps" the exit status of the child // without blocking. Note that it also decrements the count // of waiting children by one. - pid_t pid = ACE_OS::wait (-1, &child_exit_status, WNOHANG); + pid_t pid = ACE_OS::wait (-1, + &child_exit_status, + WNOHANG); // Check to see if there are anymore children to reap. if (pid == -1) break; @@ -82,7 +84,8 @@ handle_signal (int signum) child_exit_status)); } - // Bail out. + // Shutdown and bail out. + shut_down = 1; return -1; /* NOTREACHED */ @@ -276,11 +279,17 @@ worker_parent (void *) ACE_ASSERT (child_pid != -1); - // Perform a barrier wait until our child process has exited. - int result = pm.wait (); - - // Note that <result> should == -1 because our signal handler - // "reaped" the SIGCHLD. + // Perform a <wait> until our child process has exited. + int result; + + while (shut_down == 0) + { + ACE_OS::sigpause (SIGINT); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%P|%t) got signal!\n"))); + } + // Note that <result> should == -1 because our signal handler should + // have "reaped" the SIGCHLD already. ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) child done, result = %d, %p\n"), @@ -289,13 +298,6 @@ worker_parent (void *) return 0; } -extern "C" void -exithook (void) -{ - ACE_DEBUG ((LM_DEBUG, - ASYS_TEXT ("(%P|%t) I'm outta here...\n"))); -} - // Parse the command-line arguments and set options. static void @@ -333,10 +335,6 @@ main (int argc, ASYS_TCHAR *argv[]) ACE_APPEND_LOG (ASYS_TEXT ("Signal_Test-child")); parse_args (argc, argv); - // Register an exit hook so that we can tell when the child - // process exits. - ACE_OS::atexit (exithook); - run_test (worker_child); ACE_END_LOG; } @@ -370,4 +368,4 @@ main (int, ASYS_TCHAR *[]) ACE_END_TEST; return 0; } -#endif /* !ACE_LACKS_FORK */ +#endif /* !ACE_LACKS_FORK && !defined (ACE_LACKS_UNIX_SIGNALS) */ |