Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jul 2001 10:45:52 -0500
From:      David Leimbach <leimbacd@bellsouth.net>
To:        Gabriel Ambuehl <gabriel_ambuehl@buz.ch>, questions@freebsd.org
Subject:   Re: Passing data in C++ via stdin without waiting for the new process to  complete
Message-ID:  <20010708104552.C5630@mutt.home.net>
In-Reply-To: <84594262844.20010708173749@buz.ch>; from gabriel_ambuehl@buz.ch on Sun, Jul 08, 2001 at 05:37:49PM %2B0200
References:  <114577608557.20010708130014@buz.ch> <3B484403.1BA9A21D@jak.nl> <84594262844.20010708173749@buz.ch>

next in thread | previous in thread | raw e-mail | index | archive | help

> 
> Oh I've read all of those (except the dup() stuff). It's just that I
> think
> that all of the fork derivatives won't do me any good as they are
> thought to fork another copy of the current process as does, for
> example,
> Apache 1.3 to achieve simultaneous handling of concurrent requests.
> But I
> need to spawn separate, distinct executables that perform their very
> own tasks, not just a copy of the calling process.
> 
> The exec() family of calls looks more promising, but those still
> block the parent process. I need a solution, that allows the parent
> process to continue its work immediately after the child has been
> spawned, no matter how long it takes the child to complete.

They don't block the parent... they overwrite the current.


int main () {
  pid_t pid = fork();
  if (!pid) {
    //in child
    execl(...);  //do something else
    }
  else {
    //in parent code
   }


There is NO BLOCKING!!!!
> 

Dave


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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