Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files
New couch_event:listen/4 API
This function doesn't return but allows a process to become an event
listener. Useful in RPC situations to avoid spawning an extra process
and doubling the message passing.
  • Loading branch information
davisp authored and rnewson committed Jul 30, 2014
1 parent bf25e9f commit b00c879dabef34edb30c1ce6606e2b7e700532c8
Showing 2 changed files with 15 additions and 1 deletion.
@@ -38,6 +38,10 @@ notify(DbName, Event) ->
gen_server:cast(?DIST, {DbName, Event}).

listen(Module, Function, State, Options) ->
couch_event_listener_mfa:enter_loop(Module, Function, State, Options).

link_listener(Module, Function, State, Options) ->
couch_event_listener_mfa:start_link(Module, Function, State, Options).

@@ -16,7 +16,8 @@


@@ -41,6 +42,15 @@ start_link(Mod, Func, State, Options) ->
couch_event_listener:start_link(?MODULE, Arg, Options).

enter_loop(Mod, Func, State, Options) ->
St = #st{
mod = Mod,
func = Func,
state = State
couch_event_listener:enter_loop(?MODULE, St, Options).

stop(Pid) ->

0 comments on commit b00c879

Please sign in to comment.