[erlang-questions] ErlNifPid question

Steve Vinoski vinoski@REDACTED
Mon Jul 18 14:36:58 CEST 2016


On Mon, Jul 18, 2016 at 7:14 AM, Caragea Silviu <silviu.cpp@REDACTED>
wrote:

> Hello having two ErlNifPid how I can compare them to know if they refer to
> the same PID or not ?
>
> Other than avoiding calling enif_make_pid like:
>
> enif_is_identical(enif_make_pid(env, &pid1), enif_make_pid(env, &pid2))
>

This is the right way to do it. ErlNifPid is a struct with a term member
but is documented to be an opaque type, so you're not supposed to access
its term directly. But note that enif_make_pid is a C macro that does
exactly that, so there's no function call overhead from using it.

--steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160718/5b622e3a/attachment.htm>


More information about the erlang-questions mailing list