sending of messages to several childs

View: New views
5 Messages — Rating Filter:   Alert me  

sending of messages to several childs

by info-1679 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Is it possible for a "father process" to send the same message to all spawned childs ?
What is the syntax / or reference ?
Thank's

John

Re: sending of messages to several childs

by kamiseq :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

maybe you should keep pids of all your children and then iterate over the
list and send same msg?

pozdrawiam
Paweł Kamiński

kamiseq@...
pkaminski.prv@...
______________________

Parent Message unknown Re: sending of messages to several childs

by wde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


you can use spawn_link/2 to spawn your children and use erlang:process_info(Father,links) to get all linked process

if the father process is a supervisor you can use supervisor:which_children/1

you can use pg or pg2 module to add all chidren to the same group  




 

 
======= le 02/07/2009, 14:02:48 vous écriviez: =======

>Hi all,
>
>Is it possible for a "father process" to send the same message to all spawned childs ?
>What is the syntax / or reference ?
>Thank's
>
>John
>

= = = = = = = = = ========= = = = = = = = = = =
                       
wde
wde@...
02/07/2009


Re: sending of messages to several childs

by Torben Hoffmann-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi John.

There is no built in operator for that, bou could look at:
global_group <http://www.erlang.org/doc/man/global_group.html>
pg2 <http://www.erlang.org/doc/man/pg2.html>
pg <http://www.erlang.org/doc/man/pg.html>

Either way you have to do some book keeping or leg work  to make it happen.

Cheers,
Torben

On Thu, Jul 2, 2009 at 14:02, info <info@...> wrote:

> Hi all,
>
> Is it possible for a "father process" to send the same message to all
> spawned childs ?
> What is the syntax / or reference ?
> Thank's
>
> John
>



--
http://www.linkedin.com/in/torbenhoffmann

Re: Re: sending of messages to several childs

by info-1679 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This solution seems elegant. I will test it.
Thank you
John

you can use spawn_link/2 to spawn your children and use erlang:process_info(Father,links) to get all linked process

if the father process is a supervisor you can use supervisor:which_children/1

you can use pg or pg2 module to add all chidren to the same group  






 
======= le 02/07/2009, 14:02:48 vous écriviez: =======

>Hi all,
>
>Is it possible for a "father process" to send the same message to all spawned childs ?
>What is the syntax / or reference ?
>Thank's
>
>John
>

= = = = = = = = = ========= = = = = = = = = = =
wde
wde@...
02/07/2009