Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 2003 17:06:51 +0400
From:      Andrew Belashov <bel@orel.ru>
To:        freebsd-sparc64@freebsd.org
Subject:   fork&Perl BUG
Message-ID:  <3F27C2EB.2030809@orel.ru>
In-Reply-To: <3F27A5DB.2050601@orel.ru>
References:  <3F210BF6.6070001@orel.ru> <20030725153258.GE10708@funkthat.com> <3F27A5DB.2050601@orel.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
I modified Perl by adding sleep() in child after fork():
--------------------------------------------------------------
--- pp_sys.c.orig       Fri Apr  6 08:38:46 2001
+++ pp_sys.c    Wed Jul 30 16:23:39 2003
@@ -3700,6 +3700,8 @@
         RETSETUNDEF;
      if (!childpid) {
         /*SUPPRESS 560*/
+       /* CHILD */
+       sleep(60);
         if ((tmpgv = gv_fetchpv("$", TRUE, SVt_PV)))
             sv_setiv(GvSV(tmpgv), (IV)PerlProc_getpid());
         hv_clear(PL_pidstatus); /* no kids, so don't wait for 'em */
--------------------------------------------------------------

and running test script:
--------------------------------------------------------------
bel@trash$ /usr/ports/lang/perl5.debug/work/perl-5.6.1/perl \
perlbug.pl 80000
................................................................................
Main: sum = 39952.6836460792, cnt = 80000
Child pid = 90078
Parent working...
Parent: sum = 39952.6836460792, cnt = 80000
Parent waiting a child...
Parent exiting...
Parent exiting...
--------------------------------------------------------------

Wow! Child printing "Parent exiting..."!

Its like as: kernel unblock fork() in parent before end of duplicating 
memory to child!





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F27C2EB.2030809>