<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">Hi Dmitrii,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">I think the following means that if A sends M1, M2 to B, then B will receive M1, M2 in the order of sending. It's not explicitly stated that exit messages are handled the same way as regular messages, though I think the default assumption should be that they are. Those here who have worked on model checking and
whatnot, feel free to expound.</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; "><h3><a name="id54306" href="">10.8 Is the order of message reception guaranteed?</a></h3><div style="font-family: Verdana, Arial, Helvetica, sans-serif; ">Yes, but only within one process.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; ">If there is a live process and you send it message A and then message B, it's guaranteed that if message B arrived, message A arrived before it.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; ">On the other hand, imagine processes P, Q and R. P sends message A to Q, and then message B to R. There is no guarantee that A arrives before B. (Distributed Erlang
would have a pretty tough time if this was required!)</div></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">http://www.erlang.org/faq/academic.html<br></div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">Best,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">Thomas</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style:
normal; "><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Dmitrii Dimandt <dmitrii@dmitriid.com><br> <b><span style="font-weight: bold;">To:</span></b> Erlang Questions <erlang-questions@erlang.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, January 28, 2013 10:00 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> [erlang-questions] Message order and exit(Reason)<br> </font> </div> <br>
<div id="yiv1182808553"><div>Hi all,<div><br></div><div>We've had a semi-heated discussion in Russian community over this question: http://stackoverflow.com/questions/14556109/race-condition-between-trap-exit-exit-msg-and-common-msg</div><div><br></div><div>The question is as following: Assume we have processes A and B which are linked. Process's A flag trap_exit is set to true. Let B process send a msg to A and then exit:<br><br><div><font class="yiv1182808553Apple-style-span" face="'Courier New'">PidA ! 'msg',</font></div><div><font class="yiv1182808553Apple-style-span" face="'Courier New'">exit(reason).</font></div><br class="yiv1182808553Apple-interchange-newline">What I wanna know if we can be shure that the process A will receive 'msg' and only after It {'EXIT', Pid, reason} will come ? Can we predict the ordering of msgs? I can't found any proofs in documentation, but I guess that it will work that way, but I need some
proofs. Don't want to have race condition here.</div><div><br></div><div><br></div><div>Can anyone with the intimate knowledge of Erlang internals shed some light on this?</div><div><br></div><div>Thanks!</div></div></div><br>_______________________________________________<br>erlang-questions mailing list<br><a ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br><br><br> </div> </div> </blockquote></div> </div></body></html>