[erlang-questions] Sending a message to all linked processes

Robert Virding <>
Thu May 29 11:04:38 CEST 2008

2008/5/29 John M. Nordgaard <>:

> Hi all,
> Been looking through the documentation in search of an answer, and have
> not been able to locate one, so I hope I haven't missed the obvious
> here... my Erlang mileage is still nothing to brag about. :-)
> I was wondering if there is a simple and straightforward way to send a
> message to all linked processes. Now, I am aware that a process exit
> signal is transmitted in a functionally similar manner, so it seems that
> at least some form of "broadcast to all linked processes" operation exists
> within the runtime. But is it possible to invoke such functionality
> directly from source code?

send_links(Message) ->
    {link,Links} = process_info(self(), links),
    lists:foreach(fun (P) -> P ! Message end, Links).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080529/5b7a5b15/attachment.html>

More information about the erlang-questions mailing list