anchor.diff:           State   :: term(),
            Timeout :: timeout()
          ) ->
  +                        no_return();
  +       (
  +           Module  :: module(),
  +           Options :: [enter_loop_opt()],
  +           State   :: term(),
  +           Hibernate :: hibernate
  +       ) ->
  +                        no_return();
  +       (
  +           Module  :: module(),
  +           Options :: [enter_loop_opt()],
  +           State   :: term(),
  +           Continue :: {continue, term()}
  +       ) ->
                           no_return().
   %%
   enter_loop(Mod, Options, State, ServerName = {Scope, _})
  -  when Scope == local; Scope == global ->
  +    when is_atom(Mod) andalso
  +         is_list(Options) andalso
  +         (Scope == local orelse Scope == global) ->
       enter_loop(Mod, Options, State, ServerName, infinity);
   %%
  -enter_loop(Mod, Options, State, ServerName = {via, _, _}) ->
  +enter_loop(Mod, Options, State, ServerName = {via, _, _}) when is_atom(Mod) andalso is_list(Options) ->
       enter_loop(Mod, Options, State, ServerName, infinity);
   %%
  -enter_loop(Mod, Options, State, Timeout) ->
  -    enter_loop(Mod, Options, State, self(), Timeout).
  +enter_loop(Mod, Options, State, TimeoutOrHibernate)
  +    when is_atom(Mod) andalso
  +         is_list(Options) andalso
  +         (?is_timeout(TimeoutOrHibernate) orelse TimeoutOrHibernate =:= hibernate) ->
  +    enter_loop(Mod, Options, State, self(), TimeoutOrHibernate);
  +%%
  +enter_loop(Mod, Options, State, {continue, _}=Continue) when is_atom(Mod) andalso is_list(Options) ->
  +    enter_loop(Mod, Options, State, self(), Continue).
   
   -spec enter_loop(
           Module     :: module(),
           Options    :: [enter_loop_opt()],
           State      :: term(),
           ServerName :: server_name() | pid(),
  -        Timeout    :: timeout()
  +        Timeout    :: timeout() | hibernate | {continue, term()}
  +       ) ->
  +                        no_return();
  +       (
  +           Module     :: module(),
  +           Options    :: [enter_loop_opt()],
  +           State      :: term(),
  +           ServerName :: server_name() | pid(),
  +           Hibernate    :: hibernate
  +       ) ->
  +                        no_return();
  +       (
  +           Module     :: module(),
  +           Options    :: [enter_loop_opt()],
  +           State      :: term(),
  +           ServerName :: server_name() | pid(),
  +           Continue    :: {continue, term()}
          ) ->
                           no_return().
   %%
  -enter_loop(Mod, Options, State, ServerName, Timeout) ->
  +enter_loop(Mod, Options, State, ServerName, TimeoutOrHibernate)
  +    when is_atom(Mod) andalso
  +         is_list(Options) andalso
  +         (?is_timeout(TimeoutOrHibernate) orelse TimeoutOrHibernate =:= hibernate) ->
       Name = gen:get_proc_name(ServerName),
       Parent = gen:get_parent(),
       Debug = gen:debug_options(Name, Options),
       HibernateAfterTimeout = gen:hibernate_after(Options),
  -    loop(Parent, Name, State, Mod, Timeout, HibernateAfterTimeout, Debug).
  +    loop(Parent, Name, State, Mod, TimeoutOrHibernate, HibernateAfterTimeout, Debug);
  +%%
  +enter_loop(Mod, Options, State, ServerName, {continue, _}=Continue) when is_atom(Mod) andalso is_list(Options) ->
  +    Name = gen:get_proc_name(ServerName),
  +    Parent = gen:get_parent(),
  +    Debug = gen:debug_options(Name, Options),
  +    HibernateAfterTimeout = gen:hibernate_after(Options),
  +    loop(Parent, Name, State, Mod, Continue, HibernateAfterTimeout, Debug).
   
   %%%========================================================================
   %%% Gen-callback functions
  
positive.code: 	    Debug1 = sys:handle_debug(Debug, fun print_event/3, Name,
  				      {noreply, NState}),
  	    loop(Parent, Name, NState, Mod, infinity, HibernateAfterTimeout, Debug1);
  	{ok, {noreply, NState, Time1}} ->
  	    Debug1 = sys:handle_debug(Debug, fun print_event/3, Name,
  				      {noreply, NState}),
  	    loop(Parent, Name, NState, Mod, Time1, HibernateAfterTimeout, Debug1);
  	{ok, {stop, Reason, NState}} ->
  	    terminate(Reason, ?STACKTRACE(), Name, From, Msg, Mod, NState, Debug);
  	{'EXIT', Class, Reason, Stacktrace} ->
  
negative.code: -define(
     STACKTRACE(),
     element(2, erlang:process_info(self(), current_stacktrace))).
  
  -define(
  	is_timeout(X),
  	( (X) =:= infinity orelse ( is_integer(X) andalso (X) >= 0 ) )
  ).
  
  %%%=========================================================================
  %%%  API
  