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_server.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/stdlib/doc/src/gen_server.xml') 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 From 4a60e2df0ff2a95ed899768d8698d419b067d371 Mon Sep 17 00:00:00 2001 From: Anton N Ryabkov Date: Thu, 20 Apr 2017 14:25:43 +0700 Subject: Fixed typos in the gen_event, gen_fsm, gen_server documentation. --- lib/stdlib/doc/src/gen_server.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/stdlib/doc/src/gen_server.xml') diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml index f6053d501f..9df2b45fe0 100644 --- a/lib/stdlib/doc/src/gen_server.xml +++ b/lib/stdlib/doc/src/gen_server.xml @@ -418,8 +418,8 @@ gen_server:abcast -----> Module:handle_cast/2

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 + process awaits any message for AutoHibernateTimeout milliseconds and + if no message is received, the process goes into hibernation automatically (by calling proc_lib:hibernate/3).

-- cgit v1.2.3 From 38294da512781e44b44b9331bf613003397d529b Mon Sep 17 00:00:00 2001 From: Anton N Ryabkov Date: Mon, 24 Apr 2017 13:41:59 +0700 Subject: "auto_hibernate_timeout" option renamed to "hibernate_after". It was done because "hibernate_after" option already used in ssl for the same reason. --- lib/stdlib/doc/src/gen_server.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/stdlib/doc/src/gen_server.xml') diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml index 9df2b45fe0..e1d95e0046 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} | {auto_hibernate_timeout,AutoHibernateTimeout} +  Option = {debug,Dbgs} | {hibernate_after,HibernateAfterTimeout}   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} | {auto_hibernate_timeout,AutoHibernateTimeout} | {spawn_opt,SOpts} +  Option = {debug,Dbgs} | {timeout,Time} | {hibernate_after,HibernateAfterTimeout} | {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} | {auto_hibernate_timeout,AutoHibernateTimeout} | {spawn_opt,SOpts} +  Option = {debug,Dbgs} | {timeout,Time} | {hibernate_after,HibernateAfterTimeout} | {spawn_opt,SOpts}   Dbgs = [Dbg]    Dbg = trace | log | statistics | {log_to_file,FileName} | {install,{Func,FuncState}}   SOpts = [term()] @@ -417,8 +417,8 @@ gen_server:abcast -----> Module:handle_cast/2 returns {error,timeout}.

-

If option {auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_server - process awaits any message for AutoHibernateTimeout milliseconds and +

If option {hibernate_after,HibernateAfterTimeout} is present, the gen_server + process awaits any message for HibernateAfterTimeout milliseconds and if no message is received, the process goes into hibernation automatically (by calling proc_lib:hibernate/3).

-- cgit v1.2.3