summaryrefslogtreecommitdiff
path: root/ACE/tests/Proactor_Test.cpp
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-26 09:08:04 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-04-26 09:08:04 +0000
commit86add38837987c10059a2aedfae42f9f161570c8 (patch)
tree886a52a9046ce7dc6f8b4bbc684889408ed0c49f /ACE/tests/Proactor_Test.cpp
parent55024c92ad36fec2737554911795c2c0bc4c5fec (diff)
downloadATCD-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/Proactor_Test.cpp')
-rw-r--r--ACE/tests/Proactor_Test.cpp25
1 files changed, 16 insertions, 9 deletions
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 <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_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);