[erlang-questions] gen_server:call and hibernate
Thu May 19 10:35:07 CEST 2011
> "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()."
> I want to be able to hibernate the calling process after making a call to
> the gen_server process but I can't seem to think of or know how to work
> around this in an elegant way. I'm also not sure where to begin to hack
> gen.erl to do this if it is possible.
> Does anybody have a solution to my predicament here?
I'm not sure about this exact use case, but have you looked at
gen_server2 (from rabbitmq) at all? It handles timeouts differently
and drains the message queue before invoking callbacks (which
optimisation I believe has made it into gen.erl proper now).
More information about the erlang-questions