[erlang-questions] monitor/2
Loïc Hoguin
essen@REDACTED
Sat Mar 15 18:54:33 CET 2014
On 03/15/2014 05:51 PM, Lukas Larsson wrote:
> On Fri, Mar 14, 2014 at 11:50 PM, Loïc Hoguin <essen@REDACTED
> <mailto:essen@REDACTED>> wrote:
>
> It's been there for a while, and it's always taking 'process' as
> first argument. Any plans to add anything else?
>
> And if nothing is foreseen before the end of times, any plans to add
> a monitor/1 instead?
>
>
> Yes, we plan to add erlang:monitor(port,#Port). There are no plans, that
> I know of, to introduce an erlang:monitor/1.
If port monitoring gets introduced then forget what I said about
monitor/1. I just wouldn't want monitor/2 to stay the same forever if
the first argument is never gonna be used.
In what release port monitoring would land, presumably?
> Speaking of erlang:monitor, we have also been talking about adding a
> erlang:monitor/3 which would as a third argument take the identifier
> that you want to be sent back to the caller instead of the current
> reference. Is that something which could be useful to anyone?
That does sound like something I could use, yes.
The Gun HTTP client API (a few days from being public) creates a process
per connection, and then each request on the connection gets a
reference. If the user wants to do many requests on the same connection,
then creating a separate reference for the monitor makes sense, however
I could use what you propose when the user wants to do a single request
and then close the connection, we can reuse the reference from the
request in the monitor instead of creating two references.
Doing it the other way (use the monitor ref as the request ref) would
complicate the API, so that's not an option.
--
Loïc Hoguin
http://ninenines.eu
More information about the erlang-questions
mailing list