Allow monitor options in proc_lib:start_monitor/5
#9804
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the spawn options
monitor
and{monitor, MonitorOpts}
are disallowed in theproc_lib:start*
functions. This goes back all the way to R11, a ticket OTP-6345, and this post on the old Erlang ML.For
proc_lib:start_monitor
, it makes no sense to forbid monitor options. Or at least, we don't see any benefit in doing so. On the contrary, it prevents "customizing" the monitor (eg custom tags, usage of the newpriority
option, etc). This PR removes this restriction.For
proc_lib:start
andproc_lib:start_link
, it would be possible to remove the restriction also, that is, without restoring the buggy behavior that seems to have given raise to OTP-6345.However, in the presence of a
monitor
or{monitor, MonitorOpts}
spawn option, the return value would change fromRet
to{Ret, Mon}
, with repercussions viagen
into thestart
/start_link
functions of thegen_*
behaviors.This may be ok, and require mostly work on the specs and documentation in the
gen_*
behaviors, aside from some adaptions ingen
. The bigger question IMO is if and how supervisors should cope with this?This PR also does a few more things than what is listed above, which are related to the new
{link, LinkOpts}
spawn option that appeared with the new priority messages. Those are mostly just documentation changes.