[erlang-questions] gproc:monitor(Key, follow)

Ulf Wiger ulf@REDACTED
Thu May 29 15:32:53 CEST 2014


Have you looked at gproc_monitor:subscribe/1. Supposedly it does what you want.

BR,
Ulf W

On 29 May 2014, at 14:09, Camille Troillard <lists@REDACTED> wrote:

> Hello Ulf,
> 
> 
> On 29 May 2014, at 10:33, Ulf Wiger <ulf@REDACTED> wrote:
> 
>> In this sense, gproc:monitor/2 works like erlang:monitor/2, which also stays silent if the object is alive and well.
> 
> That makes sense.
> 
> 
>> Perhaps the easiest thing to do is to simply look up the name right after calling monitor()?
> 
> Yes I could do that, though I wished I only had a single place where I act on the registration notifications.
> 
> So I could use nb_wait, but there is a small discrepancy where its callback signature {gproc, Ref, registered, {Key, Pid, Value}} is not the same as the one of monitor {gproc, registered, Ref, Key}. Maybe there was a good reason for this, unfortunately this prevents me from having a unified notification of a process coming up.
> 
> 
> Thank you.
> Cam
> 
> 
>> 2014-05-28 18:04 GMT+02:00 Camille Troillard <lists@REDACTED>:
>> OK, so it seems gproc:monitor(Key, follow) works, however if the name is already registered the message {gproc, registered, Ref, Key} is not sent. I would have expected the message to be sent since {gproc, unreg, Ref, Key} is sent when the name is not registered. Is this a bug?
>> 
>> 
>> On 28 May 2014, at 17:15, Camille Troillard <lists@REDACTED> wrote:
>> 
>> > Hello,
>> >
>> > I would like to take action when a name gets registered under gproc.
>> >
>> > I understood I could call gproc:monitor(Key, follow) during initialization but my process does not get notified of the name availability. Therefore I had to replace that call to gproc:nb_wait, and then monitor the process in the callback handler. I wish I could follow the former approach.
>> >
>> > Can someone explain the usage pattern of gproc:monitor(_, follow)?
>> > I am trying to understand why this would not work.
>> > Thanks!
>> >
>> > Camille
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>> 
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

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


More information about the erlang-questions mailing list