[erlang-questions] How to fork/clone a process in Erlang?

Rich Neswold rich.neswold@REDACTED
Fri Sep 7 05:24:56 CEST 2012


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 the
> 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 Erlang?

How about:

f(),
spawn(g),
g().

-- 
Rich



More information about the erlang-questions mailing list