I suppose I could.  However, since I use get_linked_processes() for other things too, I made a library function out of it several months ago.  When I answered the question, I just cut and pasted the library function.<br><br>
When giving code examples, the easier they are to read, the better.  I don't doubt that the receiving reader could have made that substitution themselves.<br><br><br><br><div class="gmail_quote">On Fri, May 30, 2008 at 6:47 AM, Hynek Vychodil <<a href="mailto:vychodil.hynek@gmail.com">vychodil.hynek@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">you can just write :<br><br>[ LP ! Msg || LP <- begin {links, P} = process_info(self(), links), P end ].<br>
<br>or without pattern match check (less reliable way):<br><br>[ LP ! Msg || LP <- element(2, process_info(self(), links)) ].<br>
<br><div class="gmail_quote">2008/5/29 John Haugeland <<a href="mailto:stonecypher@gmail.com" target="_blank">stonecypher@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">
<br><div class="gmail_quote"><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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?<br>



</blockquote></div><div><br>There may be a better way, but here's how I do it:<br><br>get_linked_processes() -> [U] = [V||{links,V}<-process_info(self())], U.<br><br>[ LP ! message || LP <- get_linked_processes() ].<br>


<br>I suspect that process_info() isn't particularly cheap, so I recommend reconsidering the bookkeeping.<br><br>  - John<br> </div></div>---<br>GuaranteedVPS.com - bandwidth commitments and root starting from $12.98/mo
<br></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>--Hynek (Pichi) Vychodil
</font></blockquote></div><br><br clear="all"><br>-- <br>---<br>GuaranteedVPS.com - bandwidth commitments and root starting from $12.98/mo