anchor.diff:           duo_mode_loop/1]).
   
   %% cloudi_services_internal callbacks
  --export([handle_module_request_loop/3,
  -         handle_module_info_loop/3]).
  +-export([handle_module_request_loop_hibernate/2,
  +         handle_module_info_loop_hibernate/2]).
   
   -include("cloudi_configuration.hrl").
   -include("cloudi_logger.hrl").
  
positive.code:             erlang:exit(Result);
          is_integer(Uses) ->
              ResultPid ! Result,
              if
                  Hibernate =:= true ->
                      erlang:hibernate(?MODULE, handle_module_info_loop,
                                       [Uses - 1, ResultPid, Hibernate]);
                  Hibernate =:= false ->
                      % XXX ignore spurious dialyzer error
                      handle_module_info_loop(Uses - 1, ResultPid, Hibernate)
              end;
          Uses =:= infinity ->
              ResultPid ! Result,
              if
                  Hibernate =:= true ->
                      erlang:hibernate(?MODULE, handle_module_info_loop,
                                       [Uses, ResultPid, Hibernate]);
                  Hibernate =:= false ->
                      % XXX ignore spurious dialyzer error
                      handle_module_info_loop(Uses, ResultPid, Hibernate)
              end
      end.
  
  % duo_mode specific logic
  
negative.code:                                     Hibernate}, ResultPid) ->
      if
          OldInfoPid =:= undefined ->
              if
                  Hibernate =:= false ->
                      erlang:spawn_opt(fun() ->
                          handle_module_info_loop_normal(InfoPidUses,
                                                         ModuleInfo,
                                                         ResultPid)
                      end, InfoPidOptions);
                  Hibernate =:= true ->
                      erlang:spawn_opt(fun() ->
                          handle_module_info_loop_hibernate(InfoPidUses,
                                                            ModuleInfo,
                                                            ResultPid)
                      end, InfoPidOptions)
              end;
          is_pid(OldInfoPid) ->
              OldInfoPid ! ModuleInfo,
              OldInfoPid
      end.
  
  handle_module_info_loop_normal(Uses, ResultPid) ->
      receive
          {'cloudi_service_info_loop',
           _Request, _Module, _Dispatcher,
           _NewServiceState} = ModuleInfo ->
              handle_module_info_loop_normal(Uses,
                                             ModuleInfo,
                                             ResultPid)
      end.
  
  handle_module_info_loop_hibernate(Uses, ResultPid) ->
      receive
          {'cloudi_service_info_loop',
           _Request, _Module, _Dispatcher,
           _NewServiceState} = ModuleInfo ->
              handle_module_info_loop_hibernate(Uses,
                                                ModuleInfo,
                                                ResultPid)
      end.
  
  handle_module_info_loop_normal(Uses,
                                 {'cloudi_service_info_loop',
                                  Request, Module, Dispatcher,
                                  NewServiceState},
                                 ResultPid) ->
      Result = handle_module_info(Request, Module, Dispatcher,
                                  NewServiceState),
      if
  