diff options
author | Henrik Nord <[email protected]> | 2011-10-07 17:17:27 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-10-07 17:17:32 +0200 |
commit | a5abe96590ec22779f796fc67e5afbbf99a3a922 (patch) | |
tree | b22eb07f52606bc7ab5c7339026d007784aef0a4 /lib/stdlib/src/gen_server.erl | |
parent | 00202339445daae6ed931f28f932089d5c3dd455 (diff) | |
parent | ed72d05e27fcf1d4f649014ffd7a1c2878b5b010 (diff) | |
download | otp-a5abe96590ec22779f796fc67e5afbbf99a3a922.tar.gz otp-a5abe96590ec22779f796fc67e5afbbf99a3a922.tar.bz2 otp-a5abe96590ec22779f796fc67e5afbbf99a3a922.zip |
Merge branch 'sa/callback-attr'
* sa/callback-attr:
Add callback specs into 'application' module in kernel
Add callback specs to tftp module following internet documentation
Add callback specs to inets_service module following possibly deprecated comments
Add '-callback' attributes in stdlib's behaviours
Update primary bootstrap
Update the documentation with information on the callback attribute
Automatically generate 'behaviour_info' function from '-callback' attributes
Add '-callback' attribute to language syntax
OTP-9621
Diffstat (limited to 'lib/stdlib/src/gen_server.erl')
-rw-r--r-- | lib/stdlib/src/gen_server.erl | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index b8ea3a4de2..dd0ef74f30 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -94,8 +94,6 @@ multi_call/2, multi_call/3, multi_call/4, enter_loop/3, enter_loop/4, enter_loop/5, wake_hib/5]). --export([behaviour_info/1]). - %% System exports -export([system_continue/3, system_terminate/4, @@ -111,13 +109,32 @@ %%% API %%%========================================================================= --spec behaviour_info(atom()) -> 'undefined' | [{atom(), arity()}]. - -behaviour_info(callbacks) -> - [{init,1},{handle_call,3},{handle_cast,2},{handle_info,2}, - {terminate,2},{code_change,3}]; -behaviour_info(_Other) -> - undefined. +-callback init(Args :: term()) -> + {ok, State :: term()} | {ok, State :: term(), timeout() | hibernate} | + {stop, Reason :: term()} | ignore. +-callback handle_call(Request :: term(), From :: {pid(), Tag :: term()}, + State :: term()) -> + {reply, Reply :: term(), NewState :: term()} | + {reply, Reply :: term(), NewState :: term(), timeout() | hibernate} | + {noreply, NewState :: term()} | + {noreply, NewState :: term(), timeout() | hibernate} | + {stop, Reason :: term(), Reply :: term(), NewState :: term()} | + {stop, Reason :: term(), NewState :: term()}. +-callback handle_cast(Request :: term(), State :: term()) -> + {noreply, NewState :: term()} | + {noreply, NewState :: term(), timeout() | hibernate} | + {stop, Reason :: term(), NewState :: term()}. +-callback handle_info(Info :: timeout() | term(), State :: term()) -> + {noreply, NewState :: term()} | + {noreply, NewState :: term(), timeout() | hibernate} | + {stop, Reason :: term(), NewState :: term()}. +-callback terminate(Reason :: (normal | shutdown | {shutdown, term()} | + term()), + State :: term()) -> + term(). +-callback code_change(OldVsn :: (term() | {down, term()}), State :: term(), + Extra :: term()) -> + {ok, NewState :: term()}. %%% ----------------------------------------------------------------- %%% Starts a generic server. |