Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 92978 invoked from network); 31 Oct 2007 15:18:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Oct 2007 15:18:41 -0000 Received: (qmail 64656 invoked by uid 500); 31 Oct 2007 15:18:29 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 64634 invoked by uid 500); 31 Oct 2007 15:18:29 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 64623 invoked by uid 99); 31 Oct 2007 15:18:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 08:18:29 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 15:18:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A8F751A9832; Wed, 31 Oct 2007 08:18:17 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r590711 - /incubator/stdcxx/branches/4.2.x/tests/src/process.cpp Date: Wed, 31 Oct 2007 15:18:17 -0000 To: stdcxx-commits@incubator.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071031151817.A8F751A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faridz Date: Wed Oct 31 08:18:16 2007 New Revision: 590711 URL: http://svn.apache.org/viewvc?rev=590711&view=rev Log: 2007-10-31 Travis Vitek 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/branches/4.2.x/tests/src/process.cpp Modified: incubator/stdcxx/branches/4.2.x/tests/src/process.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.x/tests/src/process.cpp?rev=590711&r1=590710&r2=590711&view=diff ============================================================================== --- incubator/stdcxx/branches/4.2.x/tests/src/process.cpp (original) +++ incubator/stdcxx/branches/4.2.x/tests/src/process.cpp Wed Oct 31 08:18:16 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) {