[erlang-questions] Question on "selective receive"

Christoffer Vikström <>
Wed Feb 12 17:55:58 CET 2014


I think the "zero to inifinity" statement might need some clarification:
The timeout is a 32-bit integer and if you try to set it higher it will
fail with a bad receive timeout value.

receive after 1 bsl 32 -1 -> ok end. will work.
receive after 1 bsl 32 -> ok end. will not.

Cheers!


On Tue, Jan 21, 2014 at 8:25 AM, Avinash Dhumane <
> wrote:

>  Just thought of sharing the information that Joe's book (pp 143-144,
> under section "Receive with Timeout Value of Zero/Infinity") answers this
> question. I had gone over these paragraphs several times in the past, but
> it is only after confronted with a real life situation where these
> constructs require application of mind that these small paragraphs
> illumined their real meaning.
>
>
>
> Oh, Erlang - you're beauty!!
>
>
>
> *From:*  [mailto:
> ] *On Behalf Of *Avinash Dhumane
> *Sent:* 19 January 2014 15:58
> *To:* 
> *Subject:* [erlang-questions] Question on "selective receive"
>
>
>
> Can the timeout clause not have a guard too?
>
>
>
> If it can, what are the semantics of it? I mean, if the timeout occurs but
> guard evaluates to false, what happens to receive? Does it continue to
> block?
>
>
>
> If it cannot, why?
>
>
>
> Thanks
>
> Avinash
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140212/5c222c05/attachment.html>


More information about the erlang-questions mailing list