summaryrefslogtreecommitdiff
path: root/src/rexi.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-05-01 10:23:20 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-05-01 10:23:20 -0400
commit513cdd3ac1e23c8bf1f71c6225348f162f193d2d (patch)
treece6029b869b6cf6fd2850fdfecd01e40621bca6a /src/rexi.erl
parent6e6813d355aa7371f63e46472faaa2b326ddf394 (diff)
add ability to kill a remote worker, BugzID 10096
Diffstat (limited to 'src/rexi.erl')
-rw-r--r--src/rexi.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rexi.erl b/src/rexi.erl
index 745afedb..2608ee24 100644
--- a/src/rexi.erl
+++ b/src/rexi.erl
@@ -1,6 +1,6 @@
-module(rexi).
-export([start/0, stop/0, restart/0]).
--export([cast/2, cast/3]).
+-export([cast/2, cast/3, kill/2]).
-export([reply/1]).
-define(SERVER, rexi_server).
@@ -21,7 +21,7 @@ cast(Node, MFA) ->
%% @doc Executes apply(M, F, A) on Node.
%% You might want to use this instead of rpc:cast/4 for two reasons. First,
%% the Caller pid and the returned reference are inserted into the remote
-%% process' dictionary as 'rexi_from', so it has a way to communicate with you.
+%% process' dictionary as `rexi_from', so it has a way to communicate with you.
%% Second, the remote process is monitored. If it dies, Caller will receive a
%% message of the form `{rexi_EXIT, Ref, Reason}' where Ref is the returned
%% reference and Reason is the exit reason.
@@ -31,6 +31,12 @@ cast(Node, Caller, MFA) ->
ok = gen_server:cast({?SERVER, Node}, {doit, {Caller,Ref}, MFA}),
{ok, Ref}.
+%% @doc Sends an async kill signal to the remote process associated with Ref.
+%% No rexi_EXIT message will be sent.
+-spec kill(node(), reference()) -> ok.
+kill(Node, Ref) ->
+ ok = gen_server:cast({?SERVER, Node}, {kill, Ref}).
+
%% @doc convenience function to reply to the original rexi Caller.
-spec reply(any()) -> any().
reply(Reply) ->