[erlang-questions] [gproc] How to broadcast message to all other processes except self

Barco You <>
Tue Dec 4 17:19:43 CET 2012


Thank you for replying. But I tried to use Pid ! Msg, but seemingly can not
receive message as gproc:send(Key, Msg).

On Tue, Dec 4, 2012 at 9:31 PM, Ulf Wiger <> wrote:

>
> The function gproc:send/2, when used on a non-unique key, in essence does
> this:
>
>    lists:foreach(fun(Pid) ->
>                                         Pid ! Msg
>                           end, gproc:lookup_pids(Key)),
>
> So you can take that as a starting point, and add a clause that
> pattern-matches on the own pid, and then doesn't send a message in that
> case.
>
> BR,
> Ulf W
>
> On 4 Dec 2012, at 13:21, Barco You wrote:
>
> Dear All,
>
> I use gproc:reg to register all the processes to a KEY and through gproc:send(KEY,
> MSG) I can broadcast message to all the processes, including myself. But
> now I hope to send message to all the other processes except myself. How
> can I do it? Could you please illuminate ? Thank you.
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
> Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
> http://feuerlabs.com
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121205/9851541f/attachment.html>


More information about the erlang-questions mailing list