File 0990-Documentation-of-exit-signals-emitted-by-gen_server.patch of Package erlang

From 89c7682744d551a406f198b1f1441ab248b74956 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= <viktor.soderqvist@est.tech>
Date: Thu, 24 Sep 2020 11:51:57 +0200
Subject: [PATCH] Documentation of exit signals emitted by gen_server

The relation between Reason and the exit signal is described
in various sections of the gen_server manual:

* In the Description section, including a link to Receiving Exit
  Signals in the Reference Manual
* Under start_link/3,4
* Under stop/1,3
* Under Module:init/1
* Under Module:terminate/2
---
 lib/stdlib/doc/src/gen_server.xml | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml
index 4abb91439e..364d4b95d6 100644
--- a/lib/stdlib/doc/src/gen_server.xml
+++ b/lib/stdlib/doc/src/gen_server.xml
@@ -88,6 +88,14 @@ gen_server:abcast     -----> Module:handle_cast/2
       implies at least two garbage collections (when hibernating and
       shortly after waking up) and is not something you want to do
       between each call to a busy server.</p>
+
+    <p>If the <c>gen_server</c> process terminates, e.g.
+      as a result of a function in the callback module returning
+      <c>{stop,Reason,NewState}</c>, an exit signal with this <c>Reason</c>
+      is sent to linked processes and ports. See
+      <seealso marker="system/reference_manual:processes#errors">
+      Processes</seealso> in the Reference Manual for details
+      regarding error handling using exit signals.</p>
   </description>
 
   <funcs>
@@ -449,7 +457,10 @@ gen_server:abcast     -----> Module:handle_cast/2
           the function returns <c>{error,Reason}</c>. If
           <c>Module:init/1</c> returns <c>{stop,Reason}</c> or
           <c>ignore</c>, the process is terminated and the function
-          returns <c>{error,Reason}</c> or <c>ignore</c>, respectively.</p>
+          returns <c>{error,Reason}</c> or <c>ignore</c>, respectively.
+	  An exit signal with the same <c>Reason</c> (or <c>normal</c> if
+	  <c>Module:init/1</c> returns <c>ignore</c>) is sent to linked
+	  processes and ports.</p>
       </desc>
     </func>
 
@@ -476,6 +487,8 @@ gen_server:abcast     -----> Module:handle_cast/2
           error report to be issued using
           <seealso marker="kernel:error_logger#format/2">
           <c>error_logger:format/2</c></seealso>.
+          An exit signal with the same reason is sent to linked processes
+	  and ports.
           The default <c>Reason</c> is <c>normal</c>.</p>
         <p><c>Timeout</c> is an integer greater than zero that
           specifies how many milliseconds to wait for the server to
@@ -754,7 +767,11 @@ gen_server:abcast     -----> Module:handle_cast/2
           <c>proc_lib:hibernate/3</c></seealso>).</p>
         <p>If the initialization fails, the function is to return
           <c>{stop,Reason}</c>, where <c>Reason</c> is any term, or
-          <c>ignore</c>.</p>
+          <c>ignore</c>. An exit signal with this <c>Reason</c> (or with reason
+          <c>normal</c> if <c>ignore</c> is returned) is sent to linked
+          processes and ports, notably to the process starting the gen_server
+          when <seealso marker="#start_link/3"><c>start_link/3,4</c></seealso>
+          is used.</p>
       </desc>
     </func>
 
@@ -810,6 +827,8 @@ gen_server:abcast     -----> Module:handle_cast/2
           an error report is issued using
           <seealso marker="kernel:error_logger#format/2">
           <c>error_logger:format/2</c></seealso>.</p>
+        <p>When the gen_server process exits, an exit signal with the same
+          reason is sent to linked processes and ports.</p>
       </desc>
     </func>
   </funcs>
-- 
2.26.2

openSUSE Build Service is sponsored by