[fpc-pascal]fork with forked program

Matt Emson memsom at interalpha.co.uk
Tue Sep 16 14:12:02 CEST 2003

Michael, forgive me if I am wrong - I am not a Unix buff - but I was under
the impression that forking was a method for creating multithreaded unix
apps?!? Everytime you fork() you end up with two seperate processes running
concurrently. You differentiate between them by chacking the result given by
fork(). Certainly under Cygwin this works. I also have some code written
using POSIX calls on BeOS that creates a daemon by forking 3 times.


> I want to use fork to make multithread application for sockets and I would
> like to fork it to run in dameon mode.

Multithread is not possible with Fork()

> Can I fork the forked program? With call fork I get 0 in result in child.

This is correct. Fork returns 0 in the child and returns the child process
ID in the parent.


More information about the fpc-pascal mailing list