<div dir="ltr">Thank you! Thought so, but was not 100% sure.</div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-10 0:20 GMT+03:00 Daniel Goertzen <span dir="ltr"><<a href="mailto:daniel.goertzen@gmail.com" target="_blank">daniel.goertzen@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.</div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Sat, Jan 9, 2016 at 12:12 AM John Doe <<a href="mailto:donpedrothird@gmail.com" target="_blank">donpedrothird@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi,</div><div>Does successful call of enif_get_resource increase reference counter on a resource, like enif_keep_resource does?</div><div>Or It is neccessary to do </div><div>enif_get_resource(...);</div><div>enif_keep_resource(...);</div><div>...some job...</div><div>enif_release_resource(...);</div><div><br></div><div>And if it does not increment the counter, can the resource become destroyed in the another thread between calls to enif_get_resource and enif_keep_resource? </div><div>I'm afraid of race condition there.</div></div></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
</blockquote></div><br></div>