diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-04-26 09:08:04 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-04-26 09:08:04 +0000 |
commit | 86add38837987c10059a2aedfae42f9f161570c8 (patch) | |
tree | 886a52a9046ce7dc6f8b4bbc684889408ed0c49f /ACE/tests/TP_Reactor_Test.cpp | |
parent | 55024c92ad36fec2737554911795c2c0bc4c5fec (diff) | |
download | ATCD-86add38837987c10059a2aedfae42f9f161570c8.tar.gz |
Mon Apr 26 08:29:58 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tests/SSL/SSL_Asynch_Stream_Test.cpp:
* tests/SSL/Bug_2912_Regression_Test.cpp:
* tests/Proactor_UDP_Test.cpp:
* tests/MT_Reference_Counted_Event_Handler_Test.cpp:
* tests/Proactor_Test_IPV6.cpp:
* tests/Bug_2740_Regression_Test.cpp:
* tests/Dev_Poll_Reactor_Test.cpp:
* tests/Proactor_Test.cpp:
* tests/TP_Reactor_Test.cpp:
All these tests need to block SIGPIPE signal. POSIX defines that
newly created threads must inherit signal mask from the creating
thread. The later doesn't happen at least on Solaris 10. With this
change each new thread in the above tests will block SIGPIPE signal
individually.
Diffstat (limited to 'ACE/tests/TP_Reactor_Test.cpp')
-rw-r--r-- | ACE/tests/TP_Reactor_Test.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/ACE/tests/TP_Reactor_Test.cpp b/ACE/tests/TP_Reactor_Test.cpp index d0dff09d194..a47f51c46b2 100644 --- a/ACE/tests/TP_Reactor_Test.cpp +++ b/ACE/tests/TP_Reactor_Test.cpp @@ -248,6 +248,8 @@ MyTask::svc (void) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" (%t) MyTask started\n"))); + disable_signal (SIGPIPE, SIGPIPE); + // signal that we are ready sem_.release (1); @@ -1118,7 +1120,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) static int disable_signal (int sigmin, int sigmax) { -#if defined (ACE_HAS_PTHREADS_STD) && !defined (ACE_LACKS_PTHREAD_SIGMASK) +#if !defined (ACE_LACKS_UNIX_SIGNALS) sigset_t signal_set; if (ACE_OS::sigemptyset (&signal_set) == - 1) ACE_ERROR ((LM_ERROR, @@ -1128,17 +1130,24 @@ disable_signal (int sigmin, int sigmax) for (int i = sigmin; i <= sigmax; i++) ACE_OS::sigaddset (&signal_set, i); - // Put the <signal_set>. - if (ACE_OS::pthread_sigmask (SIG_BLOCK, &signal_set, 0) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT("Error: (%P | %t):%p\n"), - ACE_TEXT("pthread_sigmask failed"))); + // Put the <signal_set>. +# if defined (ACE_LACKS_PTHREAD_THR_SIGSETMASK) + // In multi-threaded application this is not POSIX compliant + // but let's leave it just in case. + if (ACE_OS::sigprocmask (SIG_BLOCK, &signal_set, 0) != 0) +# else + if (ACE_OS::thr_sigsetmask (SIG_BLOCK, &signal_set, 0) != 0) +# endif /* ACE_LACKS_PTHREAD_THR_SIGSETMASK */ + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("Error: (%P|%t): %p\n"), + ACE_TEXT ("SIG_BLOCK failed")), + -1); #else ACE_UNUSED_ARG(sigmin); ACE_UNUSED_ARG(sigmax); -#endif /* ACE_HAS_PTHREADS_STD && !ACE_LACKS_PTHREAD_SIGMASK */ +#endif /* ACE_LACKS_UNIX_SIGNALS */ - return 1; + return 0; } #endif /* ACE_HAS_THREADS */ @@ -1152,7 +1161,7 @@ run_main (int argc, ACE_TCHAR *argv[]) if (::parse_args (argc, argv) == -1) return -1; - ::disable_signal (SIGPIPE, SIGPIPE); + disable_signal (SIGPIPE, SIGPIPE); MyTask task1; Acceptor acceptor; |