From 86add38837987c10059a2aedfae42f9f161570c8 Mon Sep 17 00:00:00 2001 From: vzykov Date: Mon, 26 Apr 2010 09:08:04 +0000 Subject: Mon Apr 26 08:29:58 UTC 2010 Vladimir Zykov * 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. --- ACE/tests/Proactor_Test.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'ACE/tests/Proactor_Test.cpp') diff --git a/ACE/tests/Proactor_Test.cpp b/ACE/tests/Proactor_Test.cpp index 861def76e50..637dab94d1e 100644 --- a/ACE/tests/Proactor_Test.cpp +++ b/ACE/tests/Proactor_Test.cpp @@ -122,8 +122,7 @@ public: static int disable_signal (int sigmin, int sigmax) { -#ifndef ACE_WIN32 - +#if !defined (ACE_LACKS_UNIX_SIGNALS) sigset_t signal_set; if (ACE_OS::sigemptyset (&signal_set) == - 1) ACE_ERROR ((LM_ERROR, @@ -133,17 +132,24 @@ disable_signal (int sigmin, int sigmax) for (int i = sigmin; i <= sigmax; i++) ACE_OS::sigaddset (&signal_set, i); - // Put the . - 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 . +# 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_WIN32 */ +#endif /* ACE_LACKS_UNIX_SIGNALS */ - return 1; + return 0; } @@ -348,6 +354,7 @@ MyTask::svc (void) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) MyTask started\n"))); disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX); + disable_signal (SIGPIPE, SIGPIPE); // signal that we are ready sem_.release (1); -- cgit v1.2.1