From 793fe40e3883bca7c37b71fb59616a4ec8d379b1 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen
Date: Tue, 23 Feb 2016 16:55:45 +0100
Subject: Rename Client -> Caller
---
lib/stdlib/doc/src/gen_statem.xml | 50 +++++++++++++++++++--------------------
lib/stdlib/src/gen_statem.erl | 42 ++++++++++++++++----------------
2 files changed, 46 insertions(+), 46 deletions(-)
(limited to 'lib/stdlib')
diff --git a/lib/stdlib/doc/src/gen_statem.xml b/lib/stdlib/doc/src/gen_statem.xml
index bd210a0d22..5ae930f48b 100644
--- a/lib/stdlib/doc/src/gen_statem.xml
+++ b/lib/stdlib/doc/src/gen_statem.xml
@@ -270,13 +270,13 @@ erlang:'!' -----> Module:StateName/5
-
+
- Client address to use when replying through for example the
+
Destination to use when replying through for example the
- transition_op() {reply,Client,Reply}
+ transition_op() {reply,Caller,Reply}
- to a client that has called the gen_statem server using
+ to a process that has called the gen_statem server using
call/2.
@@ -318,7 +318,7 @@ erlang:'!' -----> Module:StateName/5
External events are of 3 different type:
- {call,Client}, cast or info.
+ {call,Caller}, cast or info.
Calls (synchronous) and casts (asynchronous)
originate from the corresponding API functions.
For calls the event contain whom to reply to.
@@ -476,7 +476,7 @@ erlang:'!' -----> Module:StateName/5
reply_action()
- - Reply to a calling client.
+ - Reply to a caller.
next_event
- Insert the given EventType
and EventContent as the next to process.
@@ -525,11 +525,11 @@ erlang:'!' -----> Module:StateName/5
-
Reply to a client that called
+
Reply to a caller waiting for a reply in
call/2.
- Client must be the term from the
+ Caller must be the term from the
- {call,Client}
+ {call,Caller}
argument to the
state function.
@@ -747,13 +747,13 @@ erlang:'!' -----> Module:StateName/5
The gen_statem will call the
state function with
event_type()
- {call,Client} and event content
+ {call,Caller} and event content
Request.
A Reply is generated when a
state function
returns with
- {reply,Client,Reply} as one
+ {reply,Caller,Reply} as one
transition_op()
,
@@ -803,21 +803,21 @@ erlang:'!' -----> Module:StateName/5
- Send a reply to a client
+ Reply to a caller
This function can be used by a gen_statem
- to explicitly send a reply to a client that called
+ to explicitly send a reply to a process that waits in
call/2
when the reply cannot be defined in
- the return value of the
+ the return value of a
state function.
- Client must be the term from the
+
Caller must be the term from the
- {call,Client}
+ {call,Caller}
argument to the
state function.
- Client and Reply
+ Caller and Reply
can also be specified using a
reply_action()
@@ -975,7 +975,7 @@ erlang:'!' -----> Module:StateName/5
start_link/3,4.
This function may use
- throw,
+ throw
to return Result.
@@ -1024,16 +1024,16 @@ erlang:'!' -----> Module:StateName/5
then Module:handle_event/5 is called.
If EventType is
- {call,Client}
- the client is waiting for a reply. The reply can be sent
+ {call,Caller}
+ the caller is waiting for a reply. The reply can be sent
from this or from any other
state function
- by returning with {reply,Client,Reply} in
+ by returning with {reply,Caller,Reply} in
Ops, in
Replies
or by calling
- reply(Client, Reply)
+ reply(Caller, Reply)
.
StateName is useful in some odd cases for example
@@ -1121,7 +1121,7 @@ erlang:'!' -----> Module:StateName/5
.
This function may use
- throw,
+ throw
to return Ignored, which is ignored anyway.
@@ -1177,7 +1177,7 @@ erlang:'!' -----> Module:StateName/5
If the function returns Reason, the ongoing
upgrade will fail and roll back to the old release.
This function may use
- throw,
+ throw
to return Result or Reason.
@@ -1268,7 +1268,7 @@ erlang:'!' -----> Module:StateName/5
being written to the error log.
This function may use
- throw,
+ throw
to return Status.
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl
index 32799f5afc..48dfaec42a 100644
--- a/lib/stdlib/src/gen_statem.erl
+++ b/lib/stdlib/src/gen_statem.erl
@@ -51,7 +51,7 @@
%%% Interface functions.
%%%==========================================================================
--type client() ::
+-type caller() ::
{To :: pid(), Tag :: term()}. % Reply-to specifier for call
-type state() ::
state_name() | % For state callback function StateName/5
@@ -59,7 +59,7 @@
-type state_name() :: atom().
-type data() :: term().
-type event_type() ::
- {'call',Client :: client()} | 'cast' |
+ {'call',Caller :: caller()} | 'cast' |
'info' | 'timeout' | 'internal'.
-type event_predicate() :: % Return true for the event in question
fun((event_type(), term()) -> boolean()).
@@ -101,8 +101,8 @@
{'unlink', % Unlink and clean up mess(ages)
Id :: pid() | port()}.
-type reply_action() ::
- {'reply', % Reply to a client
- Client :: client(), Reply :: term()}.
+ {'reply', % Reply to a caller
+ Caller :: caller(), Reply :: term()}.
-type state_callback_result() ::
{'stop', % Stop the server
Reason :: term()} |
@@ -216,13 +216,13 @@ callback_mode(CallbackMode) ->
false
end.
%%
-client({Pid,Tag}) when is_pid(Pid), is_reference(Tag) ->
+caller({Pid,Tag}) when is_pid(Pid), is_reference(Tag) ->
true;
-client(_) ->
+caller(_) ->
false.
%%
-event_type({call,Client}) ->
- client(Client);
+event_type({call,Caller}) ->
+ caller(Caller);
event_type(Type) ->
case Type of
cast ->
@@ -341,7 +341,7 @@ cast(ServerRef, Msg) when is_pid(ServerRef) ->
do_send(ServerRef, cast(Msg)).
%% Call a state machine (synchronous; a reply is expected) that
-%% arrives with type {call,Client}
+%% arrives with type {call,Caller}
-spec call(ServerRef :: server_ref(), Request :: term()) -> Reply :: term().
call(ServerRef, Request) ->
call(ServerRef, Request, infinity).
@@ -400,13 +400,13 @@ call(ServerRef, Request, Timeout) ->
%% Reply from a state machine callback to whom awaits in call/2
-spec reply([reply_action()] | reply_action()) -> ok.
-reply({reply,{_To,_Tag}=Client,Reply}) ->
- reply(Client, Reply);
+reply({reply,{_To,_Tag}=Caller,Reply}) ->
+ reply(Caller, Reply);
reply(Replies) when is_list(Replies) ->
[reply(Reply) || Reply <- Replies],
ok.
%%
--spec reply(Client :: client(), Reply :: term()) -> ok.
+-spec reply(Caller :: caller(), Reply :: term()) -> ok.
reply({To,Tag}, Reply) ->
Msg = {Tag,Reply},
try To ! Msg of
@@ -703,8 +703,8 @@ loop_receive(Parent, Debug, #{timer := Timer} = S) ->
_ ->
Event =
case Msg of
- {'$gen_call',Client,Request} ->
- {{call,Client},Request};
+ {'$gen_call',Caller,Request} ->
+ {{call,Caller},Request};
{'$gen_cast',E} ->
{cast,E};
_ ->
@@ -950,8 +950,8 @@ process_transition_actions([], Debug, _S, Q, P) ->
process_transition_actions(
[Action|Actions] = AllActions, Debug, S, Q, P) ->
case Action of
- {reply,{_To,_Tag}=Client,Reply} ->
- NewDebug = do_reply(Debug, S, Client, Reply),
+ {reply,{_To,_Tag}=Caller,Reply} ->
+ NewDebug = do_reply(Debug, S, Caller, Reply),
process_transition_actions(Actions, NewDebug, S, Q, P);
{next_event,Type,Content} ->
case event_type(Type) of
@@ -987,17 +987,17 @@ reply_then_terminate(Class, Reason, Stacktrace, Debug, S, Q, []) ->
reply_then_terminate(
Class, Reason, Stacktrace, Debug, S, Q, [R|Rs] = RRs) ->
case R of
- {reply,{_To,_Tag}=Client,Reply} ->
- NewDebug = do_reply(Debug, S, Client, Reply),
+ {reply,{_To,_Tag}=Caller,Reply} ->
+ NewDebug = do_reply(Debug, S, Caller, Reply),
reply_then_terminate(
Class, Reason, Stacktrace, NewDebug, S, Q, Rs);
_ ->
RRs % bad_return_value
end.
-do_reply(Debug, S, Client, Reply) ->
- reply(Client, Reply),
- sys_debug(Debug, S, {out,Reply,Client}).
+do_reply(Debug, S, Caller, Reply) ->
+ reply(Caller, Reply),
+ sys_debug(Debug, S, {out,Reply,Caller}).
%% Remove oldest matching event from the queue(s)
--
cgit v1.2.3