diff options
Diffstat (limited to 'system/doc/design_principles/statem.xml')
-rw-r--r-- | system/doc/design_principles/statem.xml | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/system/doc/design_principles/statem.xml b/system/doc/design_principles/statem.xml index c53d569c99..6c26bd62e4 100644 --- a/system/doc/design_principles/statem.xml +++ b/system/doc/design_principles/statem.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2016</year><year>2021</year> + <year>2016</year><year>2023</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -1912,14 +1912,20 @@ do_unlock() -> to implicitly postpone any events to the <c>locked</c> state. </p> <p> - A selective receive cannot be used from a <c>gen_statem</c> + A catch-all receive should never be used from a <c>gen_statem</c> behaviour (or from any <c>gen_*</c> behaviour), as the receive statement is within the <c>gen_*</c> engine itself. - It must be there because all <seeerl marker="stdlib:sys"><c>sys</c></seeerl> compatible behaviours must respond to system messages and therefore do that in their engine receive loop, passing non-system messages to the <em>callback module</em>. + Using a catch-all receive may result in system messages + being discarded which in turn may lead to unexpected behaviour. + If a selective receive must be used then great care should be taken to + ensure that only messages pertinent to the operation are received. + Likewise, a callback must return in due time to let the engine + receive loop handle system messages, or they might time out also + leading to unexpected behaviour. </p> <p> The @@ -2528,7 +2534,7 @@ terminate(_Reason, State, _Data) -> the servers can be expected to idle for a while, and the amount of heap memory all these servers need is a problem, then the memory footprint of a server - can be mimimized by hibernating it through + can be minimized by hibernating it through <seemfa marker="stdlib:proc_lib#hibernate/3"><c>proc_lib:hibernate/3</c></seemfa>. </p> <note> |