From 759548838fa8b27eaa574233c9897d9578540a5a Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Mon, 22 Feb 2016 14:55:52 +0100 Subject: Make callback_option() mandatory --- lib/stdlib/doc/src/gen_statem.xml | 80 ++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 44 deletions(-) (limited to 'lib/stdlib/doc/src/gen_statem.xml') diff --git a/lib/stdlib/doc/src/gen_statem.xml b/lib/stdlib/doc/src/gen_statem.xml index 8462f5ff5f..bd210a0d22 100644 --- a/lib/stdlib/doc/src/gen_statem.xml +++ b/lib/stdlib/doc/src/gen_statem.xml @@ -190,7 +190,7 @@ erlang:'!' -----> Module:StateName/5

Name specification to use when starting - agen_statem server. + a gen_statem server. See start_link/3 and @@ -347,17 +347,6 @@ erlang:'!' -----> Module:StateName/5

- - - -

Option that only is valid when initializing - the gen_statem that is it can be returned from - Module:init/1 - or given to - enter_loop/5,6. -

-
-
@@ -459,7 +448,7 @@ erlang:'!' -----> Module:StateName/5 type timeout after Time milliseconds unless some other event is received before that time. Note that a retried - event counts just like a new in this respect. + or inserted event counts just like a new in this respect. If Time =:= infinity no timer is started. If Time =:= 0 the timeout event is immediately enqueued as the newest received. @@ -468,7 +457,7 @@ erlang:'!' -----> Module:StateName/5 transition_action() cancel_timer. - This timeout is cancelled automatically by any event. + This timeout is cancelled automatically by any other event. @@ -478,9 +467,9 @@ erlang:'!' -----> Module:StateName/5

The state transition actions are executed in the containing list order. This matters - for next_event where the last one in the list - will become the next event to present - to the state functions. Regarding the other actions + for next_event where the last such in the list + will become the next event to process by + the current state function. Regarding the other actions it is only for remove_event with EventPredicate and for reply_action() that the order may matter. @@ -490,7 +479,9 @@ erlang:'!' -----> Module:StateName/5 Reply to a calling client. next_event Insert the given EventType - and EventContent the next to process. + and EventContent as the next to process. + This will bypass any events in the process mailbox as well + as any other queued events. An event of type internal @@ -841,11 +832,11 @@ erlang:'!' -----> Module:StateName/5 - + Enter the gen_statem receive loop

The same as - enter_loop/6 + enter_loop/7 except that no server_name() @@ -854,12 +845,12 @@ erlang:'!' -----> Module:StateName/5 - + Enter the gen_statem receive loop

If Server_or_Ops is a list() the same as - enter_loop/6 + enter_loop/7 except that no server_name() @@ -867,7 +858,7 @@ erlang:'!' -----> Module:StateName/5 Ops = Server_or_Ops.

Otherwise the same as - enter_loop/6 + enter_loop/7 with Server = Server_or_Ops and Ops = []. @@ -875,7 +866,7 @@ erlang:'!' -----> Module:StateName/5 - + Enter the gen_statem receive loop

Makes an the calling process become a gen_statem. @@ -903,8 +894,8 @@ erlang:'!' -----> Module:StateName/5 server_name() name must have been registered accordingly before this function is called.

-

State, Data - and Ops +

CallbackMode, State, + Data and Ops have the same meanings as in the return value of Module:init/1. Also, the callback module Module @@ -938,15 +929,17 @@ erlang:'!' -----> Module:StateName/5 Initialize process and internal state Args = term() - Result = {ok,State,Data} -  | {ok,State,Data,Ops} + Result = {CallbackMode,State,Data} +  | {CallbackMode,State,Data,Ops}  | {stop,Reason} | ignore + CallbackMode = + callback_mode() + State = state() Data = data() Ops = - [transition_op() - | init_option()] + [transition_op()] Reason = term() @@ -962,21 +955,20 @@ erlang:'!' -----> Module:StateName/5

Args is the Args argument provided to the start function.

If the initialization is successful, the function should - return {ok,State,Data} or - {ok,State,Data,Ops}. - State is the state + return {CallbackMode,State,Data} or + {CallbackMode,State,Data,Ops}. + CallbackMode selects the + callback_mode(). of the gen_statem. + State is the state() + of the gen_statem and + Data the server data()

The Ops are executed when entering the first state just as for a state function.

-

This function allows an option to select the callback mode - of the gen_statem. See - init_option. - This option is not allowed from the state function(s). -

If something goes wrong during the initialization the function should return {stop,Reason} or ignore. See @@ -984,7 +976,7 @@ erlang:'!' -----> Module:StateName/5

This function may use throw, - to return its value. + to return Result.

@@ -1065,7 +1057,7 @@ erlang:'!' -----> Module:StateName/5

These functions may use throw, - to return its value. + to return Result.

@@ -1130,7 +1122,7 @@ erlang:'!' -----> Module:StateName/5

This function may use throw, - to return its value. + to return Ignored, which is ignored anyway.

@@ -1184,11 +1176,11 @@ 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, - to return its value. + to return Result or Reason.

+ @@ -1277,7 +1269,7 @@ erlang:'!' -----> Module:StateName/5

This function may use throw, - to return its value. + to return Status.

-- cgit v1.2.3