From 9d7d1207ff1240b9711f192deb0893c3a044a3d8 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 30 Apr 2014 09:35:06 +0200 Subject: Add synchronous stop functions to gen_server and gen_fsm The functions utilize proc_lib:stop, which in turn utilizes sys:terminate. --- lib/stdlib/doc/src/gen_fsm.xml | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'lib/stdlib/doc/src/gen_fsm.xml') diff --git a/lib/stdlib/doc/src/gen_fsm.xml b/lib/stdlib/doc/src/gen_fsm.xml index 1713367bd8..24468b0e8e 100644 --- a/lib/stdlib/doc/src/gen_fsm.xml +++ b/lib/stdlib/doc/src/gen_fsm.xml @@ -4,7 +4,7 @@
- 19962013 + 19962014 Ericsson AB. All Rights Reserved. @@ -43,8 +43,11 @@
 gen_fsm module                    Callback module
 --------------                    ---------------
+gen_fsm:start
 gen_fsm:start_link                -----> Module:init/1
 
+gen_fsm:stop                      -----> Module:terminate/3
+
 gen_fsm:send_event                -----> Module:StateName/2
 
 gen_fsm:send_all_state_event      -----> Module:handle_event/3
@@ -186,6 +189,39 @@ gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4
           for a description of arguments and return values.

+ + stop(FsmRef) -> ok + stop(FsmRef, Reason, Timeout) -> ok + Synchronously stop a generic FSM. + + FsmRef = Name | {Name,Node} | {global,GlobalName} + | {via,Module,ViaName} | pid() +  Node = atom() +  GlobalName = ViaName = term() + Reason = term() + Timeout = int()>0 | infinity + + +

Orders a generic FSM to exit with the given Reason + and waits for it to terminate. The gen_fsm will call + Module:terminate/3 + before exiting.

+

The function returns ok if the generic FSM terminates + with the expected reason. Any other reason than normal, + shutdown, or {shutdown,Term} will cause an + error report to be issued using + error_logger:format/2. + The default Reason is normal.

+

Timeout is an integer greater than zero which + specifies how many milliseconds to wait for the generic FSM + to terminate, or the atom infinity to wait + indefinitely. The default value is infinity. If the + generic FSM has not terminated within the specified time, a + timeout exception is raised.

+

If the process does not exist, a noproc exception + is raised.

+
+
send_event(FsmRef, Event) -> ok Send an event asynchronously to a generic FSM. -- cgit v1.2.3