diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-08-30 03:58:48 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-08-30 03:58:48 +0000 |
commit | ff678844642f9d4631395f44a401eb0cd388e422 (patch) | |
tree | 316981b8ee2f4d616845c47c3b7c557b340a6407 | |
parent | b8c46d82e174d6bfaaff9c637d85f3191c1fb2e8 (diff) | |
download | ATCD-ff678844642f9d4631395f44a401eb0cd388e422.tar.gz |
ChangeLogTag:Sun Aug 29 22:57:26 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r-- | ChangeLog-99b | 101 | ||||
-rw-r--r-- | ace/ARGV.h | 7 | ||||
-rw-r--r-- | ace/config-osf1-4.0.h | 2 | ||||
-rw-r--r-- | ace/config-qnx-neutrino.h | 2 | ||||
-rw-r--r-- | ace/config-vxworks5.x.h | 2 | ||||
-rw-r--r-- | tests/Signal_Test.cpp | 44 |
6 files changed, 95 insertions, 63 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index a32a3eebb29..859f4e6cf8f 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,10 @@ +Sun Aug 29 22:57:26 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + + * tests/Signal_Test.cpp (worker_parent): Revised the test + so that we transmit the parent process ID in argv so that the + child doesn't have to "guess." This should solve the annoying + problems with Linux threads... + Sun Aug 29 21:35:17 1999 David L. Levine <levine@cs.wustl.edu> * ace/config-g++-common.h: @@ -28,53 +35,53 @@ Sun Aug 29 21:35:17 1999 David L. Levine <levine@cs.wustl.edu> Sun Aug 29 07:53:33 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * tests/Signal_Test.cpp: Linux threads are evil because getppid() - isn't the process id of your parent PROCESS, it's the process id - of your parent THREAD. Yikes! Therefore, I had to rearrange - this test so that it'll work on Linux. - - * ace/config-qnx-neutrino.h, - * ace/config-vxworks5.x.h, - * ace/config-osf1-4.0.h, - * ace/config-sunos5.5.h, - * ace/config-linux-common.h: Added support for - the ACE_HAS_SIGTIMEDWAIT and ACE_HAS_SIGSUSPEND macros. - - * ace/OS: Added a new sigsuspend() wrapper to class ACE_OS. This - implementation is "smarter" than the default behavior of - sigsuspend(2) because it'll handle NULL sigset_t *'s gracefully. - - * ace/Signal: Make the use of ACE_Sig_Set & parameters - const-correct. - - * ace/Signal: Added a new method for ACE_Sig_Action that'll register - an ACE_Sig_Set's worth of signals simultaneously. - - * ace/Signal: Updated the documentation to explain what the various - constructors do. - - * ace/Process.h: Updated the documentation for ACE_Process::spawn() - to explain what the return values are. - - * tests/Makefile: Added Signal_Test to the list of tests that are - built automatically. - - * tests: Added a new test, Signal_Test.cpp, that exercises the - various signal handling capabilities supported by ACE on various - OS platforms. - - * ace/OS.h, - * ace/README, - * ace/config-vxworks5.x.h: - Removed all mention of the ACE_LACKS_ATEXIT feature. This is - now the default behavior because we ACE_OS_Object_Manager::at_exit() - to get consistent semantics, as described below. Thanks to David - for pointing this out. - - * ace/OS.i: Changed the implementation of ACE_OS::atexit() to always - use the ACE_OS_Object_Manager::instance ()->at_exit() method so - that we get consistent semantics across platforms. - + * tests/Signal_Test.cpp: Linux threads are problematic because + getppid() isn't the process id of your parent PROCESS, it's the + "process" id of your parent THREAD. Yikes! Therefore, I had to + rearrange this test so that it'll work on Linux. + + * ace/config-qnx-neutrino.h, + * ace/config-vxworks5.x.h, + * ace/config-osf1-4.0.h, + * ace/config-sunos5.5.h, + * ace/config-linux-common.h: Added support for + the ACE_HAS_SIGTIMEDWAIT and ACE_HAS_SIGSUSPEND macros. + + * ace/OS: Added a new sigsuspend() wrapper to class ACE_OS. This + implementation is "smarter" than the default behavior of + sigsuspend(2) because it'll handle NULL sigset_t *'s gracefully. + + * ace/Signal: Make the use of ACE_Sig_Set & parameters + const-correct. + + * ace/Signal: Added a new method for ACE_Sig_Action that'll register + an ACE_Sig_Set's worth of signals simultaneously. + + * ace/Signal: Updated the documentation to explain what the various + constructors do. + + * ace/Process.h: Updated the documentation for ACE_Process::spawn() + to explain what the return values are. + + * tests/Makefile: Added Signal_Test to the list of tests that are + built automatically. + + * tests: Added a new test, Signal_Test.cpp, that exercises the + various signal handling capabilities supported by ACE on various + OS platforms. + + * ace/OS.h, + * ace/README, + * ace/config-vxworks5.x.h: + Removed all mention of the ACE_LACKS_ATEXIT feature. This is + now the default behavior because we ACE_OS_Object_Manager::at_exit() + to get consistent semantics, as described below. Thanks to David + for pointing this out. + + * ace/OS.i: Changed the implementation of ACE_OS::atexit() to always + use the ACE_OS_Object_Manager::instance ()->at_exit() method so + that we get consistent semantics across platforms. + Sun Aug 29 18:27:38 1999 Ossama Othman <othman@cs.wustl.edu> * ACE.ifnames: diff --git a/ace/ARGV.h b/ace/ARGV.h index 4dcc762065c..7edc64f0a9c 100644 --- a/ace/ARGV.h +++ b/ace/ARGV.h @@ -48,9 +48,12 @@ public: // each $ENV encountered in the string. The <buf> operation is not // allowed on an ACE_ARGV created this way. - ACE_ARGV (ASYS_TCHAR *first_argv[], ASYS_TCHAR *second_argv[], int substitute_env_args =1); + ACE_ARGV (ASYS_TCHAR *first_argv[], + ASYS_TCHAR *second_argv[], + int substitute_env_args =1); // Creates an ACE_ARGV which is the concatenation of the first_argv - // and the second argv. The argv arguments should be null pointer terminated. + // and the second argv. The argv arguments should be null pointer + // terminated. ACE_ARGV (int substitute_env_args = 1); // Entry point for creating an ASYS_TCHAR *[] command line diff --git a/ace/config-osf1-4.0.h b/ace/config-osf1-4.0.h index b8d720342bc..d441dc548e2 100644 --- a/ace/config-osf1-4.0.h +++ b/ace/config-osf1-4.0.h @@ -207,6 +207,8 @@ #define ACE_LACKS_RWLOCK_T #define ACE_LACKS_THREAD_STACK_ADDR #define ACE_PAGE_SIZE 8192 +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND // DJT 6/10/96 All these broken macro's can now be removed with the // approporiate ordering of the include files. The Platinum release diff --git a/ace/config-qnx-neutrino.h b/ace/config-qnx-neutrino.h index 6d2850959d9..703037661ef 100644 --- a/ace/config-qnx-neutrino.h +++ b/ace/config-qnx-neutrino.h @@ -123,6 +123,8 @@ #define ACE_NEEDS_HUGE_THREAD_STACKSIZE 64000 #define ACE_TEMPLATES_REQUIRE_SOURCE #define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND #if !defined (ACE_NTRACE) # define ACE_NTRACE 1 diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h index 2a663d3f1de..f95330fe410 100644 --- a/ace/config-vxworks5.x.h +++ b/ace/config-vxworks5.x.h @@ -156,6 +156,8 @@ #define ACE_PAGE_SIZE 4096 #define ACE_THR_PRI_FIFO_DEF 101 #define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF +#define ACE_HAS_SIGTIMEDWAIT +#define ACE_HAS_SIGSUSPEND #if !defined (ACE_MT_SAFE) # define ACE_MT_SAFE 1 diff --git a/tests/Signal_Test.cpp b/tests/Signal_Test.cpp index 726ea9f4fda..c70d39f8b1b 100644 --- a/tests/Signal_Test.cpp +++ b/tests/Signal_Test.cpp @@ -22,6 +22,7 @@ #include "ace/Process.h" #include "ace/Signal.h" #include "ace/Get_Opt.h" +#include "ace/ARGV.h" ACE_RCSID(tests, Signal_Test, "$Id$") @@ -216,7 +217,8 @@ worker_child (void *) ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) sending SIGHUP to parent process %d\n"), parent_pid)); - int result = ACE_OS::kill (parent_pid, SIGHUP); + int result = ACE_OS::kill (parent_pid, + SIGHUP); ACE_ASSERT (result != -1); } } @@ -247,11 +249,9 @@ run_test (ACE_THR_FUNC worker) result = ACE_Thread_Manager::instance ()->spawn (synchronous_signal_handler, 0, THR_DETACHED); ACE_ASSERT (result != -1); - } -#else +#endif /* 0 */ } synchronous_signal_handler (0); -#endif /* 0 */ // Wait for the other thread to finish. result = ACE_Thread_Manager::instance ()->wait (); @@ -269,15 +269,32 @@ worker_parent (void *) { ACE_Process_Options options; + ASYS_TCHAR *l_argv[3]; + TCHAR pid_str[12]; + // Store the parent's process id so we can pass it to the child + // portably. + ACE_OS::sprintf (pid_str, "%d", ACE_OS::getpid ()); + // We're going to create a new process that runs this program again, // so we need to indicate that it's the child. - options.command_line (ACE_TEXT (".") - ACE_DIRECTORY_SEPARATOR_STR - ACE_TEXT ("Signal_Test") - ACE_PLATFORM_EXE_SUFFIX - ACE_TEXT (" -c")); + l_argv[0] = ASYS_TEXT (".") + ACE_DIRECTORY_SEPARATOR_STR + ASYS_TEXT ("Signal_Test") + ACE_PLATFORM_EXE_SUFFIX + ASYS_TEXT (" -c -p"); + l_argv[1] = pid_str; + l_argv[2] = 0; + + ACE_ARGV argv (l_argv); + + // Generate a command-line! + options.command_line (argv.buf ()); ACE_Process pm; + child_pid = pm.spawn (options); + ACE_DEBUG ((LM_DEBUG, + ASYS_TEXT ("(%P|%t) spawning child %d\n"), + child_pid)); ACE_ASSERT (child_pid != -1); @@ -308,7 +325,7 @@ worker_parent (void *) static void parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opt (argc, argv, "i:ch"); + ACE_Get_Opt get_opt (argc, argv, "i:chp:"); int c; @@ -323,6 +340,9 @@ parse_args (int argc, char *argv[]) child = 1; break; } + case 'p': + parent_pid = ACE_OS::atoi (get_opt.optarg); + break; case 'h': default: ACE_DEBUG ((LM_DEBUG, @@ -340,10 +360,6 @@ main (int argc, ASYS_TCHAR *argv[]) ACE_APPEND_LOG (ASYS_TEXT ("Signal_Test-child")); parse_args (argc, argv); - // Obtain this information here because wierd things happen on - // Linux due to their threading model. - parent_pid = ACE_OS::getppid (); - run_test (worker_child); ACE_END_LOG; } |