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/src')
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
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_event.xml | 4 ++--
lib/stdlib/doc/src/gen_server.xml | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'lib/stdlib/doc/src')
diff --git a/lib/stdlib/doc/src/gen_event.xml b/lib/stdlib/doc/src/gen_event.xml
index fbd6cf220a..efcf80390b 100644
--- a/lib/stdlib/doc/src/gen_event.xml
+++ b/lib/stdlib/doc/src/gen_event.xml
@@ -421,8 +421,8 @@ gen_event:stop -----> Module:terminate/2
-
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
+ 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).
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 063bebc88358f66cea17e3cf777b8b561a5f14c0 Mon Sep 17 00:00:00 2001
From: Anton N Ryabkov
Date: Mon, 24 Apr 2017 12:54:09 +0700
Subject: Added support of auto_hibernate_timeout option for gen_statem.
---
lib/stdlib/doc/src/gen_statem.xml | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
(limited to 'lib/stdlib/doc/src')
diff --git a/lib/stdlib/doc/src/gen_statem.xml b/lib/stdlib/doc/src/gen_statem.xml
index 17a3a3c83c..9405868c78 100644
--- a/lib/stdlib/doc/src/gen_statem.xml
+++ b/lib/stdlib/doc/src/gen_statem.xml
@@ -452,6 +452,21 @@ handle_event(_, _, State, Data) ->
+
+
+
+
+ auto_hibernate_timeout option that can be used when starting
+ a gen_statem server through,
+ enter_loop/4-6.
+
+ If option{auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_statem
+ 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).
+
+
+
@@ -1550,6 +1565,13 @@ handle_event(_, _, State, Data) ->
{error,timeout}.
+ -
+
If option{auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_statem
+ 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).
+
+
-
If option
--
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_event.xml | 8 ++++----
lib/stdlib/doc/src/gen_server.xml | 10 +++++-----
lib/stdlib/doc/src/gen_statem.xml | 12 ++++++------
3 files changed, 15 insertions(+), 15 deletions(-)
(limited to 'lib/stdlib/doc/src')
diff --git a/lib/stdlib/doc/src/gen_event.xml b/lib/stdlib/doc/src/gen_event.xml
index efcf80390b..5576f50bc0 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} | {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()]
@@ -385,7 +385,7 @@ gen_event:stop -----> Module:terminate/2
Name = atom()
GlobalName = ViaName = 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()]
@@ -420,8 +420,8 @@ gen_event:stop -----> Module:terminate/2
Thus, {via,global,GlobalName} is a valid reference.
-
-
If option {auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_event
- process awaits any message for AutoHibernateTimeout milliseconds and
+
If option {hibernate_after,HibernateAfterTimeout} is present, the gen_event
+ 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).
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).
diff --git a/lib/stdlib/doc/src/gen_statem.xml b/lib/stdlib/doc/src/gen_statem.xml
index 9405868c78..1aac88c308 100644
--- a/lib/stdlib/doc/src/gen_statem.xml
+++ b/lib/stdlib/doc/src/gen_statem.xml
@@ -453,15 +453,15 @@ handle_event(_, _, State, Data) ->
-
+
- auto_hibernate_timeout option that can be used when starting
+ hibernate_after option that can be used when starting
a gen_statem server through,
enter_loop/4-6.
- If option{auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_statem
- process awaits any message for AutoHibernateTimeout milliseconds and
+
If option{hibernate_after,HibernateAfterTimeout} is present, the gen_statem
+ 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).
@@ -1566,8 +1566,8 @@ handle_event(_, _, State, Data) ->
-
-
If option{auto_hibernate_timeout,AutoHibernateTimeout} is present, the gen_statem
- process awaits any message for AutoHibernateTimeout milliseconds and
+
If option{hibernate_after,HibernateAfterTimeout} is present, the gen_statem
+ 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