Add send_to_key/2 to send a message and return the pid/s it went to #35

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@jcomellas

To use gproc to register names using the via mechanism that was recently added to OTP (gen_server, gen_fsm, gen_event) it must provide a send/2 function with the following spec:

send(Name :: term(), Msg :: term()) -> pid().

Currently gproc:send/2 returns the message that was sent and because of
that gproc cannot be used as a drop-in name registry for OTP. This patch
adds the sent_to_key/2 function to be able to implement a name registry
on top of gproc. The new function has the following spec:

send_to_key(Name :: term(), Msg :: term()) -> pid() | [pid()].

It will return the pid or list of pids the message was sent to.

@jcomellas jcomellas Change send/2 so that it returns the pid or pids the message was sent to
To use gproc to register names using the 'via' mechanism that was
recently added to OTP (gen_server, gen_fsm, gen_event) it must provide a
send/2 function with the following spec:

    send(Name :: term(), Msg :: term()) -> pid().

Currently gproc:send/2 returns the message that was sent and because of
that gproc cannot be used as a drop-in name registry for OTP. This patch
adds the sent_to_key/2 function to be able to implement a name registry
on top of gproc. The new function has the following spec:

   send_to_key(Name :: term(), Msg :: term()) -> pid() | [pid()].

It will return the pid or list of pids the message was sent to.
ff7944b
@uwiger uwiger closed this May 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment