From 42faed747858483506c12e722573e48d0f5f7996 Mon Sep 17 00:00:00 2001 From: Anton N Ryabkov Date: Wed, 12 Apr 2017 15:06:39 +0700 Subject: Added support of auto_hibernate_timeout option for gen_server, gen_fsm, gen_event process's. There is realized gen_server, gen_fsm, gen_event automatic hibernation functionality. Added unit tests for realized functionality. Added documentation for auto_hibernate_timeout option. --- lib/stdlib/doc/src/gen_event.xml | 10 ++++++++-- lib/stdlib/doc/src/gen_server.xml | 12 +++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/gen_event.xml b/lib/stdlib/doc/src/gen_event.xml index 56cb7974a2..fbd6cf220a 100644 --- a/lib/stdlib/doc/src/gen_event.xml +++ b/lib/stdlib/doc/src/gen_event.xml @@ -358,7 +358,7 @@ gen_event:stop -----> Module:terminate/2  Name = atom()  GlobalName = ViaName = term() Options = [Option] -  Option = {debug,Dbgs} | {timeout,Time} | {spawn_opt,SOpts} +  Option = {debug,Dbgs} | {timeout,Time} | {auto_hibernate_timeout,AutoHibernateTimeout} | {spawn_opt,SOpts}   Dbgs = [Dbg]    Dbg = trace | log | statistics | {log_to_file,FileName} | {install,{Func,FuncState}}   SOpts = [term()] @@ -385,7 +385,7 @@ gen_event:stop -----> Module:terminate/2  Name = atom()  GlobalName = ViaName = term() Options = [Option] -  Option = {debug,Dbgs} | {timeout,Time} | {spawn_opt,SOpts} +  Option = {debug,Dbgs} | {timeout,Time} | {auto_hibernate_timeout,AutoHibernateTimeout} | {spawn_opt,SOpts}   Dbgs = [Dbg]    Dbg = trace | log | statistics | {log_to_file,FileName} | {install,{Func,FuncState}}   SOpts = [term()] @@ -419,6 +419,12 @@ gen_event:stop -----> Module:terminate/2 global. Thus, {via,global,GlobalName} is a valid reference.

+ +

If option {auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_event + process wait any message AutoHibernateTimeout milliseconds and + in case of no message was received, process goes into hibernation automatically + (by calling proc_lib:hibernate/3).

+

If the event manager is successfully created, the function returns {ok,Pid}, where Pid is the pid of diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml index 0bcbbc2805..f6053d501f 100644 --- a/lib/stdlib/doc/src/gen_server.xml +++ b/lib/stdlib/doc/src/gen_server.xml @@ -199,7 +199,7 @@ gen_server:abcast -----> Module:handle_cast/2 Module = atom() Options = [Option] -  Option = {debug,Dbgs} +  Option = {debug,Dbgs} | {auto_hibernate_timeout,AutoHibernateTimeout}   Dbgs = [Dbg]    Dbg = trace | log | statistics     | {log_to_file,FileName} | {install,{Func,FuncState}} @@ -334,7 +334,7 @@ gen_server:abcast -----> Module:handle_cast/2 Module = atom() Args = term() Options = [Option] -  Option = {debug,Dbgs} | {timeout,Time} | {spawn_opt,SOpts} +  Option = {debug,Dbgs} | {timeout,Time} | {auto_hibernate_timeout,AutoHibernateTimeout} | {spawn_opt,SOpts}   Dbgs = [Dbg]    Dbg = trace | log | statistics | {log_to_file,FileName} | {install,{Func,FuncState}}   SOpts = [term()] @@ -364,7 +364,7 @@ gen_server:abcast -----> Module:handle_cast/2 Module = atom() Args = term() Options = [Option] -  Option = {debug,Dbgs} | {timeout,Time} | {spawn_opt,SOpts} +  Option = {debug,Dbgs} | {timeout,Time} | {auto_hibernate_timeout,AutoHibernateTimeout} | {spawn_opt,SOpts}   Dbgs = [Dbg]    Dbg = trace | log | statistics | {log_to_file,FileName} | {install,{Func,FuncState}}   SOpts = [term()] @@ -416,6 +416,12 @@ gen_server:abcast -----> Module:handle_cast/2 initializing or it is terminated and the start function returns {error,timeout}.

+ +

If option {auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_server + process wait any message AutoHibernateTimeout milliseconds and + in case of no message was received, process goes into hibernation automatically + (by calling proc_lib:hibernate/3).

+

If option {debug,Dbgs} is present, the corresponding sys function is called for each -- cgit v1.2.3