summaryrefslogtreecommitdiff
path: root/ACE
diff options
context:
space:
mode:
Diffstat (limited to 'ACE')
-rw-r--r--ACE/ChangeLog17
-rw-r--r--ACE/tests/Bug_2740_Regression_Test.cpp40
-rw-r--r--ACE/tests/Dev_Poll_Reactor_Test.cpp43
-rw-r--r--ACE/tests/MT_Reference_Counted_Event_Handler_Test.cpp55
-rw-r--r--ACE/tests/Proactor_Test.cpp25
-rw-r--r--ACE/tests/Proactor_Test_IPV6.cpp25
-rw-r--r--ACE/tests/Proactor_UDP_Test.cpp27
-rw-r--r--ACE/tests/SSL/Bug_2912_Regression_Test.cpp68
-rw-r--r--ACE/tests/SSL/SSL_Asynch_Stream_Test.cpp30
-rw-r--r--ACE/tests/TP_Reactor_Test.cpp27
10 files changed, 260 insertions, 97 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index a9afc4e9598..b13d7944f8e 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,20 @@
+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.
+
Thu Apr 22 07:51:42 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* Release:
diff --git a/ACE/tests/Bug_2740_Regression_Test.cpp b/ACE/tests/Bug_2740_Regression_Test.cpp
index 8c31bfda748..5a451a17e24 100644
--- a/ACE/tests/Bug_2740_Regression_Test.cpp
+++ b/ACE/tests/Bug_2740_Regression_Test.cpp
@@ -282,12 +282,46 @@ ServerSvcHandler::handle_close(ACE_HANDLE handle, ACE_Reactor_Mask mask)
mask);
}
+static int
+disable_signal (int sigmin, int sigmax)
+{
+#if !defined (ACE_LACKS_UNIX_SIGNALS)
+ sigset_t signal_set;
+ if (ACE_OS::sigemptyset (&signal_set) == - 1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Error: (%P|%t):%p\n"),
+ ACE_TEXT ("sigemptyset failed")));
+
+ for (int i = sigmin; i <= sigmax; i++)
+ ACE_OS::sigaddset (&signal_set, i);
+
+ // 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_LACKS_UNIX_SIGNALS */
+
+ return 0;
+}
ACE_THR_FUNC_RETURN
event_loop(void *arg)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%t: Starting reactor event loop\n")));
+ disable_signal (SIGPIPE, SIGPIPE);
+
ACE_Reactor *reactor = static_cast<ACE_Reactor*>(arg);
int s = reactor->run_reactor_event_loop();
@@ -301,11 +335,7 @@ int run_main(int, ACE_TCHAR *[])
ACE_START_TEST (ACE_TEXT ("Bug_2740_Regression_Test"));
// Make sure we ignore SIGPIPE
- sigset_t sigsetNew[1];
- sigset_t sigsetOld[1];
- ACE_OS::sigemptyset (sigsetNew);
- ACE_OS::sigaddset (sigsetNew, SIGPIPE);
- ACE_OS::sigprocmask (SIG_BLOCK, sigsetNew, sigsetOld);
+ disable_signal (SIGPIPE, SIGPIPE);
ACE_Dev_Poll_Reactor dp_reactor;
dp_reactor.restart (1); // Restart on EINTR
diff --git a/ACE/tests/Dev_Poll_Reactor_Test.cpp b/ACE/tests/Dev_Poll_Reactor_Test.cpp
index 81dbd1f49f4..062c4ccd04b 100644
--- a/ACE/tests/Dev_Poll_Reactor_Test.cpp
+++ b/ACE/tests/Dev_Poll_Reactor_Test.cpp
@@ -441,9 +441,46 @@ public:
// ----------------------------------------------------
+static int
+disable_signal (int sigmin, int sigmax)
+{
+#if !defined (ACE_LACKS_UNIX_SIGNALS)
+ sigset_t signal_set;
+ if (ACE_OS::sigemptyset (&signal_set) == - 1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Error: (%P|%t):%p\n"),
+ ACE_TEXT ("sigemptyset failed")));
+
+ for (int i = sigmin; i <= sigmax; i++)
+ ACE_OS::sigaddset (&signal_set, i);
+
+ // 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_LACKS_UNIX_SIGNALS */
+
+ return 0;
+}
+
+// ----------------------------------------------------
+
ACE_THR_FUNC_RETURN
server_worker (void *p)
{
+ disable_signal (SIGPIPE, SIGPIPE);
+
const unsigned short port = *(static_cast<unsigned short *> (p));
ACE_INET_Addr addr;
@@ -510,11 +547,7 @@ run_main (int, ACE_TCHAR *[])
ACE_START_TEST (ACE_TEXT ("Dev_Poll_Reactor_Test"));
// Make sure we ignore SIGPIPE
- sigset_t sigsetNew[1];
- sigset_t sigsetOld[1];
- ACE_OS::sigemptyset (sigsetNew);
- ACE_OS::sigaddset (sigsetNew, SIGPIPE);
- ACE_OS::sigprocmask (SIG_BLOCK, sigsetNew, sigsetOld);
+ disable_signal (SIGPIPE, SIGPIPE);
ACE_Dev_Poll_Reactor dp_reactor;
dp_reactor.restart (1); // Restart on EINTR
diff --git a/ACE/tests/MT_Reference_Counted_Event_Handler_Test.cpp b/ACE/tests/MT_Reference_Counted_Event_Handler_Test.cpp
index 3cc4b712184..7bcb4b59ef3 100644
--- a/ACE/tests/MT_Reference_Counted_Event_Handler_Test.cpp
+++ b/ACE/tests/MT_Reference_Counted_Event_Handler_Test.cpp
@@ -108,6 +108,39 @@ static int test_configs[][5] =
// { 1, 1, 1, 1, 1, }, // No need for nested upcalls without event loop being used by the receiver.
};
+static int
+disable_signal (int sigmin, int sigmax)
+{
+#if !defined (ACE_LACKS_UNIX_SIGNALS)
+ sigset_t signal_set;
+ if (ACE_OS::sigemptyset (&signal_set) == - 1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Error: (%P|%t):%p\n"),
+ ACE_TEXT ("sigemptyset failed")));
+
+ for (int i = sigmin; i <= sigmax; i++)
+ ACE_OS::sigaddset (&signal_set, i);
+
+ // 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_LACKS_UNIX_SIGNALS */
+
+ return 0;
+}
+
/* Replication of the ACE_Pipe class. Only difference is that this
class always uses two sockets to create the pipe, even on platforms
that support pipes. */
@@ -421,6 +454,8 @@ Receiver::svc (void)
ACE_TEXT("(%t) Receiver::svc commencing, handle = %d\n"),
this->handle_));
+ disable_signal (SIGPIPE, SIGPIPE);
+
while (result != -1)
{
result =
@@ -848,6 +883,8 @@ Invocation_Thread::svc (void)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Invocation_Thread::svc commencing\n")));
+ disable_signal (SIGPIPE, SIGPIPE);
+
for (int message_counter = 1;; ++message_counter)
{
// Get a connection from the cache.
@@ -983,6 +1020,8 @@ Close_Socket_Thread::svc (void)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Close_Socket_Thread::svc commencing\n")));
+ disable_signal (SIGPIPE, SIGPIPE);
+
for (; !this->reactor_.reactor_event_loop_done ();)
{
// Wait for the new connection to be established.
@@ -1061,6 +1100,8 @@ Event_Loop_Thread::svc (void)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Event_Loop_Thread::svc commencing\n")));
+ disable_signal (SIGPIPE, SIGPIPE);
+
while (!this->reactor_.reactor_event_loop_done ())
{
this->reactor_.handle_events ();
@@ -1102,6 +1143,8 @@ Purger_Thread::svc (void)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT("(%t) Purger_Thread::svc commencing\n")));
+ disable_signal (SIGPIPE, SIGPIPE);
+
for (; !this->reactor_.reactor_event_loop_done ();)
{
// Get a connection from the cache.
@@ -1384,17 +1427,7 @@ run_main (int argc, ACE_TCHAR *argv[])
if (result != 0)
return result;
-#if defined (SIGPIPE) && !defined (ACE_LACKS_UNIX_SIGNALS)
- // There's really no way to deal with this in a portable manner, so
- // we just have to suck it up and get preprocessor conditional and
- // ugly.
- //
- // Impractical to have each call to the ORB protect against the
- // implementation artifact of potential writes to dead connections,
- // as it'd be way expensive. Do it here; who cares about SIGPIPE in
- // these kinds of applications, anyway?
- (void) ACE_OS::signal (SIGPIPE, (ACE_SignalHandler) SIG_IGN);
-#endif /* SIGPIPE */
+ disable_signal (SIGPIPE, SIGPIPE);
int ignore_nested_upcalls = 1;
int perform_nested_upcalls = 0;
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);
diff --git a/ACE/tests/Proactor_Test_IPV6.cpp b/ACE/tests/Proactor_Test_IPV6.cpp
index f1cc290b93a..f66b47227f2 100644
--- a/ACE/tests/Proactor_Test_IPV6.cpp
+++ b/ACE/tests/Proactor_Test_IPV6.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);
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);
diff --git a/ACE/tests/SSL/Bug_2912_Regression_Test.cpp b/ACE/tests/SSL/Bug_2912_Regression_Test.cpp
index 0f25b43308b..88a48674945 100644
--- a/ACE/tests/SSL/Bug_2912_Regression_Test.cpp
+++ b/ACE/tests/SSL/Bug_2912_Regression_Test.cpp
@@ -54,6 +54,39 @@ ACE_RCSID (tests,
#define DATA "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define DATA_SIZE ACE_OS::strlen(DATA)
+// Function to remove signals from the signal mask.
+static int
+disable_signal (int sigmin, int sigmax)
+{
+#if !defined (ACE_LACKS_UNIX_SIGNALS)
+ sigset_t signal_set;
+ if (ACE_OS::sigemptyset (&signal_set) == - 1)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Error: (%P|%t):%p\n"),
+ ACE_TEXT ("sigemptyset failed")));
+
+ for (int i = sigmin; i <= sigmax; i++)
+ ACE_OS::sigaddset (&signal_set, i);
+
+ // 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_LACKS_UNIX_SIGNALS */
+
+ return 0;
+}
/**
* Client's proactor
@@ -79,6 +112,9 @@ typedef ACE_Singleton<Client_Proactor_Task, ACE_SYNCH_RECURSIVE_MUTEX>
int
Client_Proactor_Task::svc (void)
{
+ // Keep RT signals on POSIX from killing us.
+ disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX);
+
CLIENT_PROACTOR->proactor_reset_event_loop ();
CLIENT_PROACTOR->proactor_run_event_loop ();
return 0;
@@ -106,6 +142,9 @@ typedef ACE_Singleton<Server_Proactor_Task, ACE_SYNCH_RECURSIVE_MUTEX>
int
Server_Proactor_Task::svc (void)
{
+ // Keep RT signals on POSIX from killing us.
+ disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX);
+
SERVER_PROACTOR->proactor_reset_event_loop ();
SERVER_PROACTOR->proactor_run_event_loop ();
return 0;
@@ -189,35 +228,6 @@ init_ssl (void)
}
-// Function to remove signals from the signal mask.
-static int
-disable_signal (int sigmin, int sigmax)
-{
-#ifndef ACE_WIN32
-
- sigset_t signal_set;
- if (ACE_OS::sigemptyset (&signal_set) == - 1)
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("Error: (%P|%t):%p\n"),
- ACE_TEXT ("sigemptyset failed")));
-
- 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")));
-#else
- ACE_UNUSED_ARG (sigmin);
- ACE_UNUSED_ARG (sigmax);
-#endif /* ACE_WIN32 */
-
- return 1;
-}
-
-
/**
* Server's ACE_Service_Handler
*/
diff --git a/ACE/tests/SSL/SSL_Asynch_Stream_Test.cpp b/ACE/tests/SSL/SSL_Asynch_Stream_Test.cpp
index 1ee2239fb80..bd1f64dc4dd 100644
--- a/ACE/tests/SSL/SSL_Asynch_Stream_Test.cpp
+++ b/ACE/tests/SSL/SSL_Asynch_Stream_Test.cpp
@@ -146,8 +146,7 @@ static const char *test_string = "SSL_Asynch_Stream_Test!";
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,
@@ -157,17 +156,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;
}
static void
@@ -451,6 +457,9 @@ proactor_loop (void *)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Start handling events.\n")));
+ disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX);
+ disable_signal (SIGPIPE, SIGPIPE);
+
int result =
ACE_Proactor::instance ()->proactor_run_event_loop ();
if (result == -1)
@@ -471,6 +480,9 @@ start_clients (void *)
ACE_INET_Addr addr (rendezvous);
ACE_SSL_SOCK_Connector connect;
+ disable_signal (ACE_SIGRTMIN, ACE_SIGRTMAX);
+ disable_signal (SIGPIPE, SIGPIPE);
+
for (size_t i = 0 ; i < cli_conn_no; i++)
{
ACE_SSL_SOCK_Stream stream;
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;