[erlang-questions] : gen_server call and reply

Raimo Niskanen <>
Wed Sep 19 11:13:13 CEST 2007


I might step into something unplesent here, but...

I think Christian and Matthias ment that Ulf's statement was
an example that demonstrated it must be allowed to call
gen_server:reply/2 both before and after return {noreply,_},
or else it would be unusable.



On Tue, Sep 18, 2007 at 07:09:41PM -0500, Scott Lystig Fritchie wrote:
> >>>>> "ml" == Matthias Lang <> writes:
> 
> ml> Christian S writes:
> 
> >> One case that struck my mind is when one spaws a process to do
> >> something and return the value with gen_server:reply/2. That
> >> requires gen_server:reply/2 to need to be executed before the
> >> gen_server:handle_call/3 returns noreply.
> 
> ml> That's a good point. That pretty much kills my doubts.
> 
> I'm now quite puzzled.  Perhaps I haven't had enough coffee today.
> 
> Assume the following two timelines, where time advances as we read
> from top to bottom:
> 
>     gen_server proc                  helper proc
>     ---------------                  -----------
>     start executing handle_call/3
>     spawn helper proc
>                                      do stuff for arbitrary time...
>                                      call gen_server:reply/2
>     return {noreply, ...}
> 
> My understanding of Christian's statement is that this timeline
> results in invalid behavior:
> 
>     gen_server proc                  helper proc
>     ---------------                  -----------
>     start executing handle_call/3
>     spawn helper proc
>                                      do stuff for arbitrary time...
>     return {noreply, ...}
>                                      call gen_server:reply/2
> 
> If my understanding is correct, then Christian's statement is not
> correct: the server's apparent behavior will be correct in either
> timeline.
> 
> -Scott
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list