Accessing private data in a NIF C module

zambal zambal@REDACTED
Mon Dec 14 14:29:33 CET 2009


Thanks for the info. So using NIF is a bit dangerous indeed ;-) but I
guess it's mainly intended for small side-effect free functions.

-
vincent

On 14 dec, 12:19, Sverker Eriksson <sver...@REDACTED> wrote:
> zambal wrote:
> > I could not found any information about if one needs to do any manual
> > locking when accessing data via enif_get_data(env) in an exported NIF
> > function. Does anybody know if this is needed?
>
> Yes, you need to do your own locking on any data structures that you
> introduce yourself and access either through enif_get_data() or static
> variables. The callbacks load, reload, upgrade and unload are however
> thread safe.
>
> I will add more about this in the erl_nif documentation for next release.
>
> /Sverker, Erlang/OTP Ericsson
>
> ________________________________________________________________
> erlang-questions mailing list. Seehttp://www.erlang.org/faq.html
> erlang-questions (at) erlang.org


More information about the erlang-questions mailing list