In other words, for ` f(); fork(); g(); ` , I wonder if it is possible to implement fork() just as is used here, i.e. without passing any parameters/arguments to fork().<br><br><div class="gmail_quote">2012/9/7 Xiao Jia <span dir="ltr"><<a href="mailto:stfairy@gmail.com" target="_blank">stfairy@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Well, this is kind of different from what I'm thinking about. <div><br></div><div>The function <font face="courier new, monospace">g()</font> here is just a symbolic stuff, standing for the remaining control flows.</div>
<div><br></div><div>Suppose we want to implement a function, <font face="courier new, monospace">split()</font>, which is to create two identical processes on invocation. We may use <font face="courier new, monospace">fork()</font> inside <font face="courier new, monospace">split()</font>. But from the user's perspective, he just calls <font face="courier new, monospace">split()</font>. As we write the <font face="courier new, monospace">split()</font> function, we cannot assume (actually we are unable to know) what is <font face="courier new, monospace">g()</font>.<div>
<div class="h5"><div>
<br><div class="gmail_quote">2012/9/7 Rich Neswold <span dir="ltr"><<a href="mailto:rich.neswold@gmail.com" target="_blank">rich.neswold@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Thu, Sep 6, 2012 at 8:31 PM, Xiao Jia <<a href="mailto:stfairy@gmail.com" target="_blank">stfairy@gmail.com</a>> wrote:<br>
> Of course in your example the control flow is cloned as you also loop in the<br>
> spawn fun.<br>
> But what I want is a more general case. Take the following C code as an<br>
> example.<br>
><br>
> f();<br>
> fork();<br>
> g();<br>
><br>
> Here the return value of fork() is ignored, so the next steps of both the<br>
> parent and the child<br>
> process are the same, which is to execute g(). Can I achieve this in Erlang?<br>
<br>
</div>How about:<br>
<br>
f(),<br>
spawn(g),<br>
g().<br>
<span><font color="#888888"><br>
--<br>
Rich<br>
</font></span></blockquote></div><br></div></div></div></div>
</blockquote></div><br>