[erlang-questions] Can Erlang messages be delivered out of order?

Sergey S ad.sergey@REDACTED
Sun Jan 25 02:01:02 CET 2009


Does Erlang runtime guarantee that messages will be delivered in
exactly the same order as they were sent?

To illustrate my question I've written a simple example:

process_flag(trap_exit, true),
Parent = self(),

spawn_link(fun() ->
                         Parent ! hello,
                         Parent ! world

receive hello -> ok end,
receive world -> ok end,
receive {'EXIT', _Pid, normal} -> ok end.

Is it guaranteed by the runtime that the 'hello' message will always
be the first message put into mailbox, 'world' - the second one, and
{'EXIT', _Pid, normal} - third?



More information about the erlang-questions mailing list