[erlang-questions] gen_server:call and hibernate

ag3nt911 dennis.duong.646@REDACTED
Thu May 19 18:35:52 CEST 2011


Ulf,

Thanks! indeed, the gen_server:call is quite simple. I should have traced it
and saw it for myself. Initially i thought a gen_server:cast would make more
sense to use but what I couldn't grasp is why facebook developers would
prefer gen_server:call over gen_server;cast instead. Is there any catch to
using a method where:

TimerRef = erlang:start_timer(60000, self(), {timedout, Data}),
%% gen_server:call(ServerPid, {message, SomeData}),
Ref = erlang:monitor(process, ServerPid),
ServerPid ! {call, {self(), Ref}, SomeData}, 
proc_lib:hibernate(?MODULE, func, [TimerRef]).

as opposed to:

TimerRef = erlang:start_timer(60000, self(), {timedout, Data}),
gen_server:cast(ServerPid, {message, SomeData}),
proc_lib:hibernate(?MODULE, func, [TimerRef]).



--
View this message in context: http://erlang.2086793.n4.nabble.com/gen-server-call-and-hibernate-tp3534336p3536301.html
Sent from the Erlang Questions mailing list archive at Nabble.com.



More information about the erlang-questions mailing list