diff options
author | Raimo Niskanen <[email protected]> | 2016-02-23 16:55:45 +0100 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2016-02-23 16:55:45 +0100 |
commit | 793fe40e3883bca7c37b71fb59616a4ec8d379b1 (patch) | |
tree | 8bca535b234df57f67baa19e50ed3a5f83204fc0 | |
parent | 759548838fa8b27eaa574233c9897d9578540a5a (diff) | |
download | otp-793fe40e3883bca7c37b71fb59616a4ec8d379b1.tar.gz otp-793fe40e3883bca7c37b71fb59616a4ec8d379b1.tar.bz2 otp-793fe40e3883bca7c37b71fb59616a4ec8d379b1.zip |
Rename Client -> Caller
-rw-r--r-- | lib/stdlib/doc/src/gen_statem.xml | 50 | ||||
-rw-r--r-- | lib/stdlib/src/gen_statem.erl | 42 |
2 files changed, 46 insertions, 46 deletions
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 </datatype> <datatype> - <name name="client" /> + <name name="caller" /> <desc> - <p>Client address to use when replying through for example the + <p>Destination to use when replying through for example the <seealso marker="#type-transition_op"> - transition_op() {reply,Client,Reply} + transition_op() {reply,Caller,Reply} </seealso> - to a client that has called the <c>gen_statem</c> server using + to a process that has called the <c>gen_statem</c> server using <seealso marker="#call/2">call/2</seealso>. </p> </desc> @@ -318,7 +318,7 @@ erlang:'!' -----> Module:StateName/5 <name name="event_type" /> <desc> <p>External events are of 3 different type: - <c>{call,<anno>Client</anno>}</c>, <c>cast</c> or <c>info</c>. + <c>{call,<anno>Caller</anno>}</c>, <c>cast</c> or <c>info</c>. 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 </p> <taglist> <tag><c>reply_action()</c></tag> - <item>Reply to a calling client.</item> + <item>Reply to a caller.</item> <tag><c>next_event</c></tag> <item>Insert the given <c><anno>EventType</anno></c> and <c><anno>EventContent</anno></c> as the next to process. @@ -525,11 +525,11 @@ erlang:'!' -----> Module:StateName/5 <datatype> <name name="reply_action" /> <desc> - <p>Reply to a client that called + <p>Reply to a caller waiting for a reply in <seealso marker="#call/2"><c>call/2</c></seealso>. - <c><anno>Client</anno></c> must be the term from the + <c><anno>Caller</anno></c> must be the term from the <seealso marker="#type-event_type"> - <c>{call,<anno>Client</anno>}</c> + <c>{call,<anno>Caller</anno>}</c> </seealso> argument to the <seealso marker="#state_function">state function</seealso>. </p> @@ -747,13 +747,13 @@ erlang:'!' -----> Module:StateName/5 The <c>gen_statem</c> will call the <seealso marker="#state_function">state function</seealso> with <seealso marker="#type-event_type"><c>event_type()</c></seealso> - <c>{call,Client}</c> and event content + <c>{call,Caller}</c> and event content <c><anno>Request</anno></c>. </p> <p>A <c><anno>Reply</anno></c> is generated when a <seealso marker="#state_function">state function</seealso> returns with - <c>{reply,Client,<anno>Reply</anno>}</c> as one + <c>{reply,Caller,<anno>Reply</anno>}</c> as one <seealso marker="#type-transition_op"> <c>transition_op()</c> </seealso>, @@ -803,21 +803,21 @@ erlang:'!' -----> Module:StateName/5 <func> <name name="reply" arity="1" /> <name name="reply" arity="2" /> - <fsummary>Send a reply to a client</fsummary> + <fsummary>Reply to a caller</fsummary> <desc> <p>This function can be used by a <c>gen_statem</c> - to explicitly send a reply to a client that called + to explicitly send a reply to a process that waits in <seealso marker="#call/2"><c>call/2</c></seealso> when the reply cannot be defined in - the return value of the + the return value of a <seealso marker="#state_function">state function</seealso>. </p> - <p><c><anno>Client</anno></c> must be the term from the + <p><c><anno>Caller</anno></c> must be the term from the <seealso marker="#type-event_type"> - <c>{call,<anno>Client</anno>}</c> + <c>{call,<anno>Caller</anno>}</c> </seealso> argument to the <seealso marker="#state_function">state function</seealso>. - <c><anno>Client</anno></c> and <c><anno>Reply</anno></c> + <c><anno>Caller</anno></c> and <c><anno>Reply</anno></c> can also be specified using a <seealso marker="#type-reply_action"> <c>reply_action()</c> @@ -975,7 +975,7 @@ erlang:'!' -----> Module:StateName/5 <seealso marker="#start_link/3">start_link/3,4</seealso>. </p> <p>This function may use - <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso>, + <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso> to return <c>Result</c>. </p> </desc> @@ -1024,16 +1024,16 @@ erlang:'!' -----> Module:StateName/5 then <c>Module:handle_event/5</c> is called. </p> <p>If <c>EventType</c> is - <seealso marker="#type-event_type"><c>{call,Client}</c></seealso> - the client is waiting for a reply. The reply can be sent + <seealso marker="#type-event_type"><c>{call,Caller}</c></seealso> + the caller is waiting for a reply. The reply can be sent from this or from any other <seealso marker="#state_function">state function</seealso> - by returning with <c>{reply,Client,Reply}</c> in + by returning with <c>{reply,Caller,Reply}</c> in <seealso marker="#type-transition_op">Ops</seealso>, in <seealso marker="#type-reply_action">Replies</seealso> or by calling <seealso marker="#reply/2"> - <c>reply(Client, Reply)</c> + <c>reply(Caller, Reply)</c> </seealso>. </p> <p><c>StateName</c> is useful in some odd cases for example @@ -1121,7 +1121,7 @@ erlang:'!' -----> Module:StateName/5 </seealso>. </p> <p>This function may use - <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso>, + <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso> to return <c>Ignored</c>, which is ignored anyway. </p> </desc> @@ -1177,7 +1177,7 @@ erlang:'!' -----> Module:StateName/5 <p>If the function returns <c>Reason</c>, the ongoing upgrade will fail and roll back to the old release.</p> <p>This function may use - <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso>, + <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso> to return <c>Result</c> or <c>Reason</c>. </p> </desc> @@ -1268,7 +1268,7 @@ erlang:'!' -----> Module:StateName/5 being written to the error log. </p> <p>This function may use - <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso>, + <seealso marker="erts:erlang#throw/1"><c>throw</c></seealso> to return <c>Status</c>. </p> </desc> 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) |