[erlang-questions] Re: Erlang at Facebook - hibernation and gen_server

Davide Marquês <>
Mon Jul 13 06:24:10 CEST 2009


On Wed, Jul 8, 2009 at 12:16 PM,  <>wrote:

> The incompatibility is on the client side (gen:call), not the server
> side (gen_server:handle_call). There's a receive() loop inside
> gen:call that prevents a client from hibernating between dispatching
> the $call message and getting back the gen_server:reply().
>

Thanks for the feedback! Got it! :)

It seems it's just a matter of (famous last words):
 - using erlang:send_after/3 to get the process to wake up from
   hibernation after the given Timeout;
 - hibernating the client process (with proc_lib:hibernate/3) while waiting
for the reply
 - turn the control (after waking up) to a function that's ready to handle
the reply and
   the erlang:send_after/3's timeout we had set up before hibernating.

Trying this out now... results later on. :)

Cheers,
:Davide


More information about the erlang-questions mailing list