[erlang-questions] puzzle about gen_server:call/2

litao cheng litaocheng@REDACTED
Mon Sep 22 15:49:43 CEST 2008


Greetings !
I read the codes of gen_server.erl and gen.erl in stdlib, the
gen_server:call/3 invoke process is illustrated as follows:

gen_server:call/3 ->
gen:call/3 ->
gen:call/4 ->
gen:do_call/4

in the gen:do_call/4, first check if the target Process is exist by invoke
erlang:monitor/2, if the process is alive then send the message,
after the messge is sended, invoke the  wait_resp_mon/3 to wait the
response, if the Mod:handle_call return {reply, Reply, State}, then in
wait_resp_mon/3, we can receive the message and return the Reply to the
gen_server:call/2 caller. My Question is: If the Mod:handle_call return
{noreply, State}, then I see the gen_server continue the loop, not send any
message to caller, in that case I think the wait_resp_mon/3 will be blocked,
Factually I know the caller not block! Anyone can give me a explain?

thanks!
Best Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080922/f31c9d52/attachment.htm>


More information about the erlang-questions mailing list