From f979493bfa777e61d4da1460982370c0cecc1ef3 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Tue, 6 May 2014 11:50:45 +0200 Subject: Update gen_event:stop to be synchronous This function now uses proc_lib:stop, which guarantees that the process is terminated before the function return. --- lib/stdlib/doc/src/gen_event.xml | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/gen_event.xml b/lib/stdlib/doc/src/gen_event.xml index b9dfff833e..5c96d6e576 100644 --- a/lib/stdlib/doc/src/gen_event.xml +++ b/lib/stdlib/doc/src/gen_event.xml @@ -4,7 +4,7 @@
- 19962013 + 19962014 Ericsson AB. All Rights Reserved. @@ -44,6 +44,7 @@
 gen_event module                   Callback module
 ----------------                   ---------------
+gen_event:start
 gen_event:start_link       ----->  -
 
 gen_event:add_handler
@@ -177,7 +178,7 @@ gen_event:stop             ----->  Module:terminate/2
       add_handler(EventMgrRef, Handler, Args) -> Result
       Add an event handler to a generic event manager.
       
-        EventMgr = Name | {Name,Node} | {global,GlobalName}
+        EventMgrRef = Name | {Name,Node} | {global,GlobalName}
 	| {via,Module,ViaName} | pid()
          Name = Node = atom()
          GlobalName = ViaName = term()
@@ -223,7 +224,7 @@ gen_event:stop             ----->  Module:terminate/2
       add_sup_handler(EventMgrRef, Handler, Args) -> Result
       Add a supervised event handler to a generic event manager.
       
-        EventMgr = Name | {Name,Node} | {global,GlobalName}
+        EventMgrRef = Name | {Name,Node} | {global,GlobalName}
 	| {via,Module,ViaName} | pid()
          Name = Node = atom()
          GlobalName = ViaName = term()
@@ -456,19 +457,37 @@ gen_event:stop             ----->  Module:terminate/2
     
     
       stop(EventMgrRef) -> ok
+      stop(EventMgrRef, Reason, Timeout) -> ok
       Terminate a generic event manager.
       
         EventMgrRef = Name | {Name,Node} | {global,GlobalName}
 	| {via,Module,ViaName} | pid()
         Name = Node = atom()
         GlobalName = ViaName = term()
+        Reason = term()
+        Timeout = int()>0 | infinity
       
       
-        

Terminates the event manager EventMgrRef. Before - terminating, the event manager will call - Module:terminate(stop,...) for each installed event - handler.

-

See add_handler/3 for a description of the argument.

+

Orders the event manager EventMgrRef to exit with + the given Reason and waits for it to + terminate. Before terminating, the gen_event will call + Module:terminate(stop,...) + for each installed event handler.

+

The function returns ok if the event manager 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 event manager to + terminate, or the atom infinity to wait + indefinitely. The default value is infinity. If the + event manager has not terminated within the specified time, a + timeout exception is raised.

+

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

+

See add_handler/3 for a description of EventMgrRef.

-- cgit v1.2.3