[erlang-questions] enif_release_resource and enif_make_resource
Thu Jul 4 16:11:24 CEST 2019
I have following code in nif:
State *s = enif_alloc_resource(..)
ERL_NIF_TERM term = enif_make_resource(env, s);
Then later another thread (not written by me) is calling my callback
void mycallback(void *obj)
State *s = obj;
ErlNifEnv *msg_env = enif_alloc_env();
ERL_NIF_TERM term = enif_make_resource(msg_env, s);
enif_send(NULL, &s->owner, msg_env, term);
Is this code correct?
Should I put release_resource for each make_resource or only for
Is this calling of enif_send correct?
I'm afraid that I miss these answers in documentation or cannot find them.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions