www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2014/05/11/18:15:09.1

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=DarZ4inHrDwkNuAk+t59h4d8NLtptTNm/gW4WQqvmos=;
b=okLLRuSIHE66iWOv0bd26EwwgChMupjUSj8NMYXoXHF7lD5Q71cNgLtiATKP4F7r/g
Nc+rxhYPcbqjfpgjuNiJ/58t/SW2rxTtCF+zwMigtdFTvqXf/bSWnvtVbeCwinQOujyC
NXYXJkNY3ksFmp034bKEOmBkq1OSt6Cx4A5+NYdLHIrSm+vti5kolRzoNHfXQcOcp0XL
dP4cwbvO9GB1qeTNhXSvA1pHaPIL3+mdGko8N7Lvv+gdqGC0yOrcTjETNIpYBY/VPW+b
H9qSFnxLAdY9s1cUVOPna48tnfACaPFAM9vPIreFQsEGlfhB4CNLs9Ap81PE8IuJo0At
HZCw==
MIME-Version: 1.0
X-Received: by 10.52.227.138 with SMTP id sa10mr16525303vdc.25.1399845032777;
Sun, 11 May 2014 14:50:32 -0700 (PDT)
In-Reply-To: <bta0diFpl6jU1@mid.dfncis.de>
References: <op DOT xfpixiqe6zenlw AT localhost>
<bta0diFpl6jU1 AT mid DOT dfncis DOT de>
Date: Sun, 11 May 2014 17:50:32 -0400
Message-ID: <CANvU5Fz12tOKCJnqtdNG8gT3Kjx1VtyBWKn8Oa-noLjLKcDypw@mail.gmail.com>
Subject: Re: detecting child processes?
From: Matthew Petricone <strstream AT gmail DOT com>
To: djgpp AT delorie DOT com
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

--089e0111d816eb5db604f926d1b9
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I would consider using a temp file with some data regarding the situation,
almost like a semaphore. You would have to be careful about error
situations with file io.

Matthew Petricone
Strstream AT gmail DOT com
Matt AT petricone DOT org
On May 11, 2014 3:30 PM, "Hans-Bernhard Br=C3=B6ker" <HBBroeker AT t-online DOT de=
>
wrote:

> On 11.05.2014 19:59, Rod Pemberton wrote:
>
>  I have a process which spawns a child of itself via system().
>>
>> Although the parent and child are the same application, I'd now
>> like the child to function slightly differently from the parent.
>>
>
> I'll assume you're referring only to the case where the parent process is
> this same program, rather than your program being invoked as any arbitrar=
y
> other program's child process.
>
>  To do that, I need to be able to detect that the child is not
>> the parent.
>>
>
> So make the parent _tell_ the child: set an environment variable like
> "PAPA_ALREADY_THERE", pass a command line argument to the child, or
> whatever you like.
>

--089e0111d816eb5db604f926d1b9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">I would consider using a temp file with some data regarding =
the situation, almost like a semaphore. You would have to be careful about =
error situations with file io.</p>
<p dir=3D"ltr">Matthew Petricone<br>
<a href=3D"mailto:Strstream AT gmail DOT com">Strstream AT gmail DOT com</a><br>
<a href=3D"mailto:Matt AT petricone DOT org">Matt AT petricone DOT org</a></p>
<div class=3D"gmail_quote">On May 11, 2014 3:30 PM, &quot;Hans-Bernhard Br=
=C3=B6ker&quot; &lt;<a href=3D"mailto:HBBroeker AT t-online DOT de">HBBroeker AT t-on=
line.de</a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">
On 11.05.2014 19:59, Rod Pemberton wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I have a process which spawns a child of itself via system().<br>
<br>
Although the parent and child are the same application, I&#39;d now<br>
like the child to function slightly differently from the parent.<br>
</blockquote>
<br>
I&#39;ll assume you&#39;re referring only to the case where the parent proc=
ess is this same program, rather than your program being invoked as any arb=
itrary other program&#39;s child process.<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
To do that, I need to be able to detect that the child is not<br>
the parent.<br>
</blockquote>
<br>
So make the parent _tell_ the child: set an environment variable like &quot=
;PAPA_ALREADY_THERE&quot;, pass a command line argument to the child, or wh=
atever you like.<br>
</blockquote></div>

--089e0111d816eb5db604f926d1b9--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019