[erlang-questions] is this a shell bug?
Hynek Vychodil
hynek@REDACTED
Mon Apr 23 13:01:36 CEST 2012
Doesn't flush() work as well for you?
On Mon, Apr 23, 2012 at 12:23 PM, Robert Raschke
<rtrlists@REDACTED> wrote:
> Whenever I tinker with message sending and receiving in the shell, I make me
> this handy small fun (or similar) to ease my life:
>
> (erl@REDACTED)1> R = fun () -> receive X -> X after 0 ->
> no_messages_pending end end.
> #Fun<erl_eval.20.21881191>
> (erl@REDACTED)2> self() ! {a, message}.
> {a,message}
> (erl@REDACTED)3> R().
> {a,message}
> (erl@REDACTED)4> R().
> no_messages_pending
> (erl@REDACTED)5>
>
>
> Robby
>
>
> On Mon, Apr 23, 2012 at 8:56 AM, Attila Rajmund Nohl
> <attila.r.nohl@REDACTED> wrote:
>>
>> 2012/4/23 吴磊 <mjollnir.ray@REDACTED>:
>> > Erlang R15B01 (erts-5.9.1) [source] [64-bit] [smp:4:4]
>> > [async-threads:0] [hipe] [kernel-poll:false]
>> >
>> > Eshell V5.9.1 (abort with ^G)
>> > 1> self().
>> > <0.32.0>
>> > 2> process_flag(trap_exit, true).
>> > false
>> > 3> spawn_link(fun() -> ok end).
>> > <0.36.0>
>> > 4> process_info(self(), messages).
>> > {messages,[{'EXIT',<0.36.0>,normal}]}
>> > 5> receive X -> X end.
>> > {'EXIT',<0.36.0>,normal}
>> > 6> spawn_link(fun() -> ok end).
>> > <0.40.0>
>> > 7> process_info(self(), messages).
>> > {messages,[{'EXIT',<0.40.0>,normal}]}
>> > 8> receive X -> X end.
>> >
>> > shell SUSPENDING .... WHAT's happed here?
>>
>> X was already bound, so you were waiting for {'EXIT',<0.36.0>,normal},
>> but got {'EXIT',<0.40.0>,normal}
>>
>> Too bad the shell can't read my mind, I've spent more hours chasing
>> "bugs" like this than I'm willing to admit.
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Hynek Vychodil
BI consultant
GoodData
náměstí 28. října 1104/17, 602 00, Brno - Černá Pole
Office: +420 530 50 7704
E-mail: hynek@REDACTED
Web: www.gooddata.com
More information about the erlang-questions
mailing list