|
|
@ -4,6 +4,7 @@ |
|
|
|
-compile({inline_size, 128}). |
|
|
|
|
|
|
|
-include_lib("kernel/include/logger.hrl"). |
|
|
|
-include("genGbh.hrl"). |
|
|
|
|
|
|
|
-import(maps, [iterator/1, next/1]). |
|
|
|
-import(gen_call, [gcall/3, gcall/4, greply/2, try_greply/2]). |
|
|
@ -36,21 +37,11 @@ |
|
|
|
, wakeupFromHib/5 |
|
|
|
|
|
|
|
%% logger callback |
|
|
|
, format_log/1, format_log/2 |
|
|
|
, format_log/1, format_log/2, print_event/3 |
|
|
|
]). |
|
|
|
|
|
|
|
-define(STACKTRACE(), element(2, erlang:process_info(self(), current_stacktrace))). |
|
|
|
|
|
|
|
%% debug 调试相关宏定义 |
|
|
|
-define(NOT_DEBUG, []). |
|
|
|
-define(SYS_DEBUG(Debug, Name, Msg), |
|
|
|
case Debug of |
|
|
|
?NOT_DEBUG -> |
|
|
|
Debug; |
|
|
|
_ -> |
|
|
|
sys:handle_debug(Debug, fun print_event/3, Name, Msg) |
|
|
|
end). |
|
|
|
|
|
|
|
-type epmHandler() :: |
|
|
|
atom() | |
|
|
|
{atom(), term()}. |
|
|
@ -95,6 +86,7 @@ |
|
|
|
{'logfile', string()}. |
|
|
|
|
|
|
|
-type startOpt() :: |
|
|
|
daemon | |
|
|
|
{'timeout', timeout()} | |
|
|
|
{'debug', [debug_flag()]} | |
|
|
|
{'spawn_opt', [proc_lib:start_spawn_option()]} | |
|
|
@ -218,6 +210,8 @@ init_it(Starter, Parent, ServerRef, _, _, Options) -> |
|
|
|
process_flag(trap_exit, true), |
|
|
|
Name = gen:name(ServerRef), |
|
|
|
Debug = gen:debug_options(Name, Options), |
|
|
|
IsDaemon = lists:member(daemon, Options), |
|
|
|
GbhOpts = #gbhOpts{daemon = IsDaemon}, |
|
|
|
HibernateAfterTimeout = gen:hibernate_after(Options), |
|
|
|
proc_lib:init_ack(Starter, {ok, self()}), |
|
|
|
receiveIng(Parent, Name, HibernateAfterTimeout, #{}, Debug, false). |
|
|
|