<br><br><div class="gmail_quote">On Sun, Jan 25, 2009 at 12:56 PM, Sergey S <span dir="ltr"><<a href="mailto:ad.sergey@gmail.com">ad.sergey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello.<br>
<div class="Ih2E3d"><br>
> If you read the manual, you'll find that each process have it's own receive<br>
> queue, and that new messages are always placed at the end of that queue.<br>
> So, for you example, yes.<br>
<br>
</div>Thanks. I didn't know how message passing is implemented. It got away<br>
from me, while I was reading docs on that.<br>
<div class="Ih2E3d"><br>
> However, your example program don't work the way you seem to expect anyway.<br>
</div><skipped><br>
<div class="Ih2E3d">> So, even if the messages would have been pleced in the wrong order, your program would have worked just as fine.<br>
<br>
</div>Those receive-statements were supposed to illustrate the order in<br>
which I expect messages will be delivered. But you are right in that<br>
program will receive all the message independent from the order. So it<br>
was not very good example to illustrate what I expect =)<br>
<br>
--<br>
<font color="#888888">Sergey<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br>If you want test it, here is example of testing module code:<br><br>-module(messageorder).<br><br>-export([test/0]).<br><br>test() -><br> process_flag(trap_exit, true),<br> Parent = self(),<br>
flush(),<br> Pid = spawn_link(fun() -><br> Parent ! hello,<br> Parent ! world<br> end),<br> receive X -> hello = X end,<br> receive Y -> world = Y end,<br>
receive Z -> {'EXIT', Pid, normal} = Z end,<br> ok.<br><br>flush() -><br> receive _ -> flush()<br> after 0 -> ok<br> end.<br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil<br><br>Analyze your data in minutes. Share your insights instantly. Thrill your boss. Be a data hero!<br>
Try Good Data now for free: <a href="http://www.gooddata.com">www.gooddata.com</a><br>