[erlang-questions] It would be nice if one could attach a "context" value to a monitor, so you get that value back when/if the monitor is trigged

Richard Carlsson richardc@REDACTED
Thu Aug 21 10:31:33 CEST 2008


Christian S wrote:
>> Give this process a "context" value, let it monitor the target process.
>> When the monitor message arrives just send the monitor message and the
>> value to the ''original process'' (the one that wanted to monitor in the
>> beginning).
> 
> That's *smack-forehead* easy! :)
> 
> I can also hide the (to me) somewhat ugly looking 'DOWN' message with
> something more specific.  Iz nice!

Also, you already have the quite specific "ref" associated with the
monitor, which you could use as a key in a dict or ets table for the
extra information. Or combine the two ideas, having a single process
that hides the refs, the 'DOWN' messages, and the table, acting as a
"user-friendly monitor service".

    /Richard



More information about the erlang-questions mailing list