File 0129-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
@@ -99,6 +99,14 @@ gen_server:abcast     -----> Module:handle_cast/2
       in place of the time-out or hibernation value, which will immediately
       invoke the <c>handle_continue/2</c> callback.</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
+      <seeguide marker="system/reference_manual:processes#errors">
+      Processes</seeguide> in the Reference Manual for details
+      regarding error handling using exit signals.</p>
+
   </description>
 
   <funcs>
@@ -546,7 +554,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>
 
@@ -609,6 +620,8 @@ gen_server:abcast     -----> Module:handle_cast/2
           <c>shutdown</c>, or <c>{shutdown,Term}</c> causes an
           error report to be issued using
           <seeerl marker="kernel:logger"><c>logger(3)</c></seeerl>.
+          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
@@ -973,7 +986,11 @@ gen_server:abcast     -----> Module:handle_cast/2
           <c>proc_lib:hibernate/3</c></seemfa>).</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 <seemfa marker="#start_link/3"><c>start_link/3,4</c></seemfa>
+          is used.</p>
       </desc>
     </func>
 
@@ -1028,6 +1045,8 @@ gen_server:abcast     -----> Module:handle_cast/2
           process is assumed to terminate because of an error and
           an error report is issued using
           <seeerl marker="kernel:logger"><c>logger(3)</c></seeerl>.</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