How Do You Determine The PID of the Parent of a Process *

Question

I have a process in erlang that is supposed to do something immediately after spawn, then send the result back to the parent when it is finished. How do I figure out the PID of the process that spawned it?

Answer

You should pass self() to the child as one of the arguments to the entry function.

spawn_link(?MODULE, child, [self()]).
< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/4287/" >How Do You Determine The PID of the Parent of a Process< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment