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/Proactor_UDP_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/Proactor_UDP_Test.cpp')
-rw-r--r-- | ACE/tests/Proactor_UDP_Test.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/ACE/tests/Proactor_UDP_Test.cpp b/ACE/tests/Proactor_UDP_Test.cpp index 1a47dab3703..85ed010e5f4 100644 --- a/ACE/tests/Proactor_UDP_Test.cpp +++ b/ACE/tests/Proactor_UDP_Test.cpp @@ -113,13 +113,11 @@ public: virtual ~LogLocker () { ACE_LOG_MSG->release (); } }; - // Function to remove signals from the signal mask. 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, @@ -129,20 +127,26 @@ 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; } - // ************************************************************* // MyTask is ACE_Task resposible for : // 1. creation and deletion of @@ -344,6 +348,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); |