From de41d555872b0c30ce6a358ad659bc9b2d1a57a2 Mon Sep 17 00:00:00 2001 From: Matthew Sackman Date: Mon, 6 Jul 2009 17:56:55 +0100 Subject: a) reverted the change to do_send which had come in when I updated gen_server2 to R13B1 - this was a change originally made by matthias to ensure that messages cast to remote nodes are done so in order b) Add guards and slightly relax name/1 so that it works in R11B5. All tests pass in R11B5 and manual testing of the binary backoff hibernation shows that too works. --- src/gen_server2.erl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gen_server2.erl b/src/gen_server2.erl index 32941ac1..ba42c18f 100644 --- a/src/gen_server2.erl +++ b/src/gen_server2.erl @@ -152,7 +152,9 @@ %%% API %%%========================================================================= +-ifdef(use_specs). -spec behaviour_info(atom()) -> 'undefined' | [{atom(), arity()}]. +-endif. behaviour_info(callbacks) -> [{init,1},{handle_call,3},{handle_cast,2},{handle_info,2}, @@ -395,7 +397,9 @@ init_it(Starter, Parent, Name0, Mod, Args, Options) -> name({local,Name}) -> Name; name({global,Name}) -> Name; -name(Pid) when is_pid(Pid) -> Pid. +%% name(Pid) when is_pid(Pid) -> Pid; +%% when R11 goes away, drop the line beneath and uncomment the line above +name(Name) -> Name. unregister_name({local,Name}) -> _ = (catch unregister(Name)); @@ -509,12 +513,7 @@ process_msg(Parent, Name, State, Mod, Time, TimeoutState, Queue, %%% Send/recive functions %%% --------------------------------------------------- do_send(Dest, Msg) -> - case catch erlang:send(Dest, Msg, [noconnect]) of - noconnect -> - spawn(erlang, send, [Dest,Msg]); - Other -> - Other - end. + catch erlang:send(Dest, Msg). do_multi_call(Nodes, Name, Req, infinity) -> Tag = make_ref(), @@ -812,7 +811,9 @@ reply(Name, {To, Tag}, Reply, State, Debug) -> system_continue(Parent, Debug, [Name, State, Mod, Time, TimeoutState, Queue]) -> loop(Parent, Name, State, Mod, Time, TimeoutState, Queue, Debug). +-ifdef(use_specs). -spec system_terminate(_, _, _, [_]) -> no_return(). +-endif. system_terminate(Reason, _Parent, Debug, [Name, State, Mod, _Time, _TimeoutState, _Queue]) -> -- cgit v1.2.1