delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/14/06:57:29

Date: Mon, 14 Apr 1997 13:43:22 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Chris Croughton <crough45 AT amc DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: Multitasking in DJGP
In-Reply-To: <97Apr14.122452gmt+0100.21890@internet01.amc.de>
Message-ID: <Pine.SUN.3.91.970414133551.10345E-100000@is>
MIME-Version: 1.0

On Mon, 14 Apr 1997, Chris Croughton wrote:

> The bit which prints "Hello" is the child, but it isn't a separate
> program it's part of the same one.  I don't mind whether the child
> finishes before the parent continues (which it might even in a true
> multitasking environment), I do want it to run in the same program
> as the parent.

I know what `fork' does on Unix.  What I don't understand is what is so 
important about the precise way `fork' works that you need to duplicate 
it in DJGPP.  If you are willing to wait until the child exits, why can't 
you just spawn the same program, like so:

int main (int argc, char *argv[])
{
  if (argc == 1)
  {
    return spawnlp (P_WAIT, argv[0], argv[0], "Hello world!", 0);
  }
  else
  {
    printf("%s", argv[1]);
    return 0;
  }
}

> The misunderstanding, I suspect, is because I was using the term 'child'
> in the Unix sense and you read it in the DOS one.  Or Maybe Not.

No, they are still called `child processes' on Unix, so this is not the 
source of the misunderstanding.  I just don't understand what is it that 
you value so much in the peculiar way `fork' works on Unix.

- Raw text -


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