forkProcess corresponds to the POSIX
fork system call.
The
IO action passed as an argument is executed in the child
process; no other threads will be copied to the child process. On
success,
forkProcess returns the child's
ProcessID to
the parent process; in case of an error, an exception is thrown.
The exception masking state of the executed action is inherited (c.f.
forkIO), see also
forkProcessWithUnmask (
since:
2.7.0.0).
forkProcess comes with a giant warning: since any other running
threads are not copied into the child process, it's easy to go wrong:
e.g. by accessing some shared resource that was held by another thread
in the parent.
GHC note:
forkProcess is not currently very well supported when
using multiple capabilities (
+RTS -N), although it is
supported with
-threaded as long as only one capability is
being used.