[erlang-questions] How to fork/clone a process in Erlang?
Fri Sep 7 06:10:35 CEST 2012
Well, this is kind of different from what I'm thinking about.
The function g() here is just a symbolic stuff, standing for the remaining
Suppose we want to implement a function, split(), which is to create two
identical processes on invocation. We may use fork() inside split(). But
from the user's perspective, he just calls split(). As we write the
split()function, we cannot assume (actually we are unable to know)
2012/9/7 Rich Neswold <rich.neswold@REDACTED>
> On Thu, Sep 6, 2012 at 8:31 PM, Xiao Jia <stfairy@REDACTED> wrote:
> > Of course in your example the control flow is cloned as you also loop in
> > spawn fun.
> > But what I want is a more general case. Take the following C code as an
> > example.
> > f();
> > fork();
> > g();
> > Here the return value of fork() is ignored, so the next steps of both the
> > parent and the child
> > process are the same, which is to execute g(). Can I achieve this in
> How about:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions