[erlang-questions] Semantics of send

Dmitry Belyaev <>
Wed Apr 28 14:09:38 CEST 2010


Maybe I was too hurry to answer.

http://erlang.org/doc/reference_manual/processes.html#id2279644
Message sending is asynchronous and safe, the message is guaranteed to 
eventually reach the recipient, provided that the recipient exists.

"eventually" =)

Dmitry Belyaev wrote:
>
> Maybe I answered not clear enough.
>
> If you use atom() instead of pid() it is like whereis(Atom) ! Msg.
> So the code will fail if no process is registered with that name.
> Still, no checks that the message is delivered.
>
> Dmitry Belyaev wrote:
>> The code will be executed without checks are those messages delivered.
>> "Pid ! Msg" doesn't check whether process with that Pid exists.
>>
>> The only check is made if you use no pid() but atom() for registered 
>> process.
>>
>> Johan Montelius wrote:
>>>
>>>
>>>
>>> What is the semantics of send?  In the following example:
>>>
>>> to_a_or_to_ab_or_to_none(A, B) ->
>>>     A ! foo,
>>>     B ! bar,
>>>     crash().
>>>
>>> If B receives bar is it then so that A receives foo?
>>>
>>> And where is the behavior stated?
>>>
>>> Is it guaranteed by the Erlang implementation in a distributed setting?
>>>
>>> If the sender crashes, is disconnected ...
>>>
>>>  Johan
>>>
>>>
>>>
>>
>>
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>



More information about the erlang-questions mailing list