[fpc-pascal]A couple of things:

Michael Van Canneyt michael.vancanneyt at wisa.be
Tue Oct 31 17:19:26 CET 2000

On Tue, 31 Oct 2000, md wrote:

> A concepts I cannot resolve:
> Is there any way to have one process execute another totally different
> process without having
> to wait for the spawned process to terminate before continuing on?

On which system ? Linux ?

> Exec( ) style functions will create a child and wait for the child to
> terminate before 
> continuing execution.  What I am looking to do is to create a completely
> different process
> and have the Exec( ) function return as soon as the new process is
> started, not when it terminates.

-> The linux unit execXXX() and fork functions do exactly this:

  if ID=0 then
    // Parent continues execution.
    WaitPID(ID, at ExitStatus,WNOHANG);

Have a look at the examples in the docu of the linux unit.

> One idea is to have the child process daemonize itself so that it spawns
> its own child.  The daemonized process
> will then return to the orignal parent, thus allowing it to continue
> execution.  
> I am looking for nothing shared between the original process and the
> spawned process.  Even the child executable
> is actually a separately compiled program.

See above.

A similar system is possible on Windows.

Have a look at the TProcess implementation on the FCL (unit process) it
allows to do this and much more in a platform-independent way.


More information about the fpc-pascal mailing list