Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Be clear that NativeCall'ing fork() won't go well
  • Loading branch information
jnthn committed Sep 28, 2017
1 parent e0e32d0 commit 8f9443c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions doc/Language/5to6-perlfunc.pod6
Expand Up @@ -475,9 +475,18 @@ Currently unimplemented.
=item fork
Not implemented as a built in function, but available through the
C<NativeCall> interface. E. g. C<use NativeCall; sub fork returns int32 is
native { * }; say fork;>.
There is no built-in `fork` function. While it's possible to call it using
NativeCall, it's highly unlikely that the resulting process will be usable.
Perl 6 provides extensive support for, and internally uses, threads. However,
`fork` only clones the thread that called `fork`, resulting in a process that
will be missing its other threads, which will have been in unknown states and
probably holding locks. Even if a Perl 6 program doesn't knowingly start any
threads, the compiler may create some of its own in the process of precompilation,
and the VMs that Perl 6 runs on also create their own internal worker threads for
doing things like optimization and GC in the background. Thus, the presence of
threads is pretty much assured, and there's no reasonable way to make `fork`
reliably work in this case.
=head2 formats
Expand Down

0 comments on commit 8f9443c

Please sign in to comment.