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

Ulf Wiger ulf@REDACTED
Tue Dec 4 14:31:35 CET 2012

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.

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
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121204/6be74ec6/attachment.htm>

More information about the erlang-questions mailing list