Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0254-Explain-continue-Continue-in-gen_server-Mo...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0254-Explain-continue-Continue-in-gen_server-Module-init-.patch of Package erlang
From aa4b32bb10c4e1f5dc79d4c9f0088faf6bf60d25 Mon Sep 17 00:00:00 2001 From: ergl <ergl@users.noreply.github.com> Date: Thu, 28 Jan 2021 13:32:40 +0100 Subject: [PATCH] Explain {continue,Continue} in gen_server:Module:init/1 doc Also, make clear in the code that the third term returned by Module:init/1 can more than just a timeout. --- lib/stdlib/doc/src/gen_server.xml | 11 ++++++++--- lib/stdlib/src/gen_server.erl | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml index 5863bfe3a4..226fcdaf60 100644 --- a/lib/stdlib/doc/src/gen_server.xml +++ b/lib/stdlib/doc/src/gen_server.xml @@ -1027,9 +1027,10 @@ gen_server:abcast -----> Module:handle_cast/2 <p><c>Args</c> is the <c>Args</c> argument provided to the start function.</p> <p>If the initialization is successful, the function is to - return <c>{ok,State}</c>, <c>{ok,State,Timeout}</c>, or - <c>{ok,State,hibernate}</c>, where <c>State</c> is the internal - state of the <c>gen_server</c> process.</p> + return <c>{ok,State}</c>, <c>{ok,State,Timeout}</c>, + <c>{ok,State,hibernate}</c>, or <c>{ok,State,{continue,Continue}}</c> + where <c>State</c> is the internal state of the <c>gen_server</c> + process.</p> <p>If an integer time-out value is provided, a time-out occurs unless a request or a message is received within <c>Timeout</c> milliseconds. A time-out is represented by @@ -1043,6 +1044,10 @@ gen_server:abcast -----> Module:handle_cast/2 hibernation when waiting for the next message to arrive (by calling <seemfa marker="proc_lib#hibernate/3"> <c>proc_lib:hibernate/3</c></seemfa>).</p> + <p>If <c>{continue,Continue}</c> is specified, the process will + execute the <seemfa marker="#Module:handle_continue/2"> + <c>Module:handle_continue/2</c></seemfa> callback function, with + <c>Continue</c> as the first argument.</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>. An exit signal with this <c>Reason</c> (or with reason diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index 6a6194ecd3..f59456d61a 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -395,9 +395,10 @@ init_it(Starter, Parent, Name0, Mod, Args, Options) -> {ok, {ok, State}} -> proc_lib:init_ack(Starter, {ok, self()}), loop(Parent, Name, State, Mod, infinity, HibernateAfterTimeout, Debug); - {ok, {ok, State, Timeout}} -> + {ok, {ok, State, TimeoutHibernateOrContinue}} -> proc_lib:init_ack(Starter, {ok, self()}), - loop(Parent, Name, State, Mod, Timeout, HibernateAfterTimeout, Debug); + loop(Parent, Name, State, Mod, TimeoutHibernateOrContinue, + HibernateAfterTimeout, Debug); {ok, {stop, Reason}} -> %% For consistency, we must make sure that the %% registered name (if any) is unregistered before -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor