aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/gen_event.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2014-05-06 11:50:45 +0200
committerSiri Hansen <[email protected]>2014-05-26 11:53:25 +0200
commitf979493bfa777e61d4da1460982370c0cecc1ef3 (patch)
treec81725ffee2bb8d34ab2dde36dc977dc7d84de66 /lib/stdlib/src/gen_event.erl
parent9d7d1207ff1240b9711f192deb0893c3a044a3d8 (diff)
downloadotp-f979493bfa777e61d4da1460982370c0cecc1ef3.tar.gz
otp-f979493bfa777e61d4da1460982370c0cecc1ef3.tar.bz2
otp-f979493bfa777e61d4da1460982370c0cecc1ef3.zip
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.
Diffstat (limited to 'lib/stdlib/src/gen_event.erl')
-rw-r--r--lib/stdlib/src/gen_event.erl13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/stdlib/src/gen_event.erl b/lib/stdlib/src/gen_event.erl
index bb0ff46268..934b112f6f 100644
--- a/lib/stdlib/src/gen_event.erl
+++ b/lib/stdlib/src/gen_event.erl
@@ -31,8 +31,8 @@
%%% Modified by Martin - uses proc_lib, sys and gen!
--export([start/0, start/1, start_link/0, start_link/1, stop/1, notify/2,
- sync_notify/2,
+-export([start/0, start/1, start_link/0, start_link/1, stop/1, stop/3,
+ notify/2, sync_notify/2,
add_handler/3, add_sup_handler/3, delete_handler/3, swap_handler/3,
swap_sup_handler/3, which_handlers/1, call/3, call/4, wake_hib/4]).
@@ -193,7 +193,11 @@ swap_sup_handler(M, {H1, A1}, {H2, A2}) ->
which_handlers(M) -> rpc(M, which_handlers).
-spec stop(emgr_ref()) -> 'ok'.
-stop(M) -> rpc(M, stop).
+stop(M) ->
+ gen:stop(M).
+
+stop(M, Reason, Timeout) ->
+ gen:stop(M, Reason, Timeout).
rpc(M, Cmd) ->
{ok, Reply} = gen:call(M, self(), Cmd, infinity),
@@ -292,9 +296,6 @@ handle_msg(Msg, Parent, ServerName, MSL, Debug) ->
Args2, MSL, Sup, ServerName),
?reply(Reply),
loop(Parent, ServerName, MSL1, Debug, Hib);
- {From, Tag, stop} ->
- catch terminate_server(normal, Parent, MSL, ServerName),
- ?reply(ok);
{From, Tag, which_handlers} ->
?reply(the_handlers(MSL)),
loop(Parent, ServerName, MSL, Debug, false);