Author: faridz
Date: Wed Oct 31 08:19:47 2007
New Revision: 590712
URL: http://svn.apache.org/viewvc?rev=590712&view=rev
Log:
2007-10-31 Travis Vitek <[EMAIL PROTECTED]>
Merged r590711 from branches/4.2.x with a fix for STDCXX-625
* process.cpp (sig_handler): Don't re-register for signal from
within signal handler to avoid stack overflow on HP-UX and AIX.
(rw_waitpid): Set and restore signal handler inside loop so we
can avoid using the signal handler to do it.
Modified:
incubator/stdcxx/trunk/tests/src/process.cpp
Modified: incubator/stdcxx/trunk/tests/src/process.cpp
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/src/process.cpp?rev=590712&r1=590711&r2=590712&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/process.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/process.cpp Wed Oct 31 08:19:47 2007
@@ -524,8 +524,8 @@
static void
sig_handler (int)
{
- // restore the signal
- signal (SIGCHLD, sig_handler);
+ // do not re-register for signal here. it causes
+ // a stack overflow problem on HP-UX and AIX.
}
}
@@ -545,12 +545,16 @@
if (0 < timeout && 0 == ret) {
// process still active, wait
- sig_handler_t* old_handler = signal (SIGCHLD, sig_handler);
unsigned utimeout = unsigned (timeout);
do {
+ sig_handler_t* old_handler = signal (SIGCHLD, sig_handler);
+
utimeout = sleep (utimeout);
+
+ signal (SIGCHLD, old_handler);
+
if (utimeout) {
// possible that the child has exited
ret = waitpid (pid, &status, WNOHANG);
@@ -575,8 +579,6 @@
}
}
while (false);
-
- signal (SIGCHLD, old_handler);
}
if (ret == pid) {