[erlang-questions] Message order and exit(Reason)
Thomas Lindgren
thomasl_erlang@REDACTED
Mon Jan 28 10:24:32 CET 2013
Hi Dmitrii,
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.
10.8 Is the order of message reception guaranteed?
Yes, but only within one process.
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.
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!)
http://www.erlang.org/faq/academic.html
Best,
Thomas
>________________________________
> From: Dmitrii Dimandt <dmitrii@REDACTED>
>To: Erlang Questions <erlang-questions@REDACTED>
>Sent: Monday, January 28, 2013 10:00 AM
>Subject: [erlang-questions] Message order and exit(Reason)
>
>
>Hi all,
>
>
>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
>
>
>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:
>
>
>PidA ! 'msg',
>exit(reason).
>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.
>
>
>
>
>Can anyone with the intimate knowledge of Erlang internals shed some light on this?
>
>
>Thanks!
>_______________________________________________
>erlang-questions mailing list
>erlang-questions@REDACTED
>http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130128/2f8cca26/attachment.htm>
More information about the erlang-questions
mailing list