diff options
author | Raimo Niskanen <[email protected]> | 2019-02-25 12:11:51 +0100 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2019-02-25 12:11:51 +0100 |
commit | 4a4e6f28a9cf8e7fd7ec8351b8c2bffb5e2495c0 (patch) | |
tree | d824463d5916d3ff8a7ea6a4600c3176aa347ca6 /lib/stdlib/src/gen_statem.erl | |
parent | 593eec697ab26a048f0407494da3c0d5b481b3fb (diff) | |
parent | 17da9d0d5e08ef313055cf799fec7ee856fde1d4 (diff) | |
download | otp-4a4e6f28a9cf8e7fd7ec8351b8c2bffb5e2495c0.tar.gz otp-4a4e6f28a9cf8e7fd7ec8351b8c2bffb5e2495c0.tar.bz2 otp-4a4e6f28a9cf8e7fd7ec8351b8c2bffb5e2495c0.zip |
Merge branch 'solvip/stdlib/gen_statem/export-start-types'
* solvip/stdlib/gen_statem/export-start-types:
Create a gen_statem type for enter_loop options
gen_statem exports types related to starting & naming
Diffstat (limited to 'lib/stdlib/src/gen_statem.erl')
-rw-r--r-- | lib/stdlib/src/gen_statem.erl | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl index 513118a874..49911eac2c 100644 --- a/lib/stdlib/src/gen_statem.erl +++ b/lib/stdlib/src/gen_statem.erl @@ -67,6 +67,14 @@ %% Type that is exported just to be documented -export_type([transition_option/0]). +%% Type exports for start_link & friends +-export_type( + [server_name/0, + server_ref/0, + start_opt/0, + start_ret/0, + enter_loop_opt/0]). + %%%========================================================================== %%% Interface functions. %%%========================================================================== @@ -424,28 +432,26 @@ timeout_event_type(Type) -> %%% API -type server_name() :: - {'global', GlobalName :: term()} + {'global', GlobalName :: term()} | {'via', RegMod :: module(), Name :: term()} | {'local', atom()}. -type server_ref() :: - pid() + pid() | (LocalName :: atom()) | {Name :: atom(), Node :: atom()} | {'global', GlobalName :: term()} | {'via', RegMod :: module(), ViaName :: term()}. --type debug_opt() :: - {'debug', - Dbgs :: - ['trace' | 'log' | 'statistics' | 'debug' - | {'logfile', string()}]}. --type hibernate_after_opt() :: - {'hibernate_after', HibernateAfterTimeout :: timeout()}. -type start_opt() :: - debug_opt() - | {'timeout', Time :: timeout()} - | hibernate_after_opt() - | {'spawn_opt', [proc_lib:spawn_option()]}. --type start_ret() :: {'ok', pid()} | 'ignore' | {'error', term()}. + {'timeout', Time :: timeout()} + | {'spawn_opt', [proc_lib:spawn_option()]} + | enter_loop_opt(). +-type start_ret() :: + {'ok', pid()} + | 'ignore' + | {'error', term()}. +-type enter_loop_opt() :: + {'hibernate_after', HibernateAfterTimeout :: timeout()} + | {'debug', Dbgs :: [sys:debug_option()]}. @@ -558,14 +564,14 @@ reply({To,Tag}, Reply) when is_pid(To) -> %% started by proc_lib into a state machine using %% the same arguments as you would have returned from init/1 -spec enter_loop( - Module :: module(), Opts :: [debug_opt() | hibernate_after_opt()], + Module :: module(), Opts :: [enter_loop_opt()], State :: state(), Data :: data()) -> no_return(). enter_loop(Module, Opts, State, Data) -> enter_loop(Module, Opts, State, Data, self()). %% -spec enter_loop( - Module :: module(), Opts :: [debug_opt() | hibernate_after_opt()], + Module :: module(), Opts :: [enter_loop_opt()], State :: state(), Data :: data(), Server_or_Actions :: server_name() | pid() | [action()]) -> @@ -579,7 +585,7 @@ enter_loop(Module, Opts, State, Data, Server_or_Actions) -> end. %% -spec enter_loop( - Module :: module(), Opts :: [debug_opt() | hibernate_after_opt()], + Module :: module(), Opts :: [enter_loop_opt()], State :: state(), Data :: data(), Server :: server_name() | pid(), Actions :: [action()] | action()) -> |