[erlang-questions] enif_get_resource and reference counting
Sun Jan 10 11:09:36 CET 2016
Thank you! Thought so, but was not 100% sure.
2016-01-10 0:20 GMT+03:00 Daniel Goertzen <>:
> enif_get_resource() does not increase the reference count. You can think
> of the term representing the resource as counting as a reference, so as
> long as the term and its environment are alive then the resource will not
> be destroyed. In the example you have above you can skip the
> keep()/release() because the resource term w/environment keeps it alive.
> On Sat, Jan 9, 2016 at 12:12 AM John Doe <> wrote:
>> Does successful call of enif_get_resource increase reference counter on a
>> resource, like enif_keep_resource does?
>> Or It is neccessary to do
>> ...some job...
>> And if it does not increment the counter, can the resource become
>> destroyed in the another thread between calls to enif_get_resource and
>> I'm afraid of race condition there.
>> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions