Ensure that the env is clear when signaling shutdown.

This commit is contained in:
Gregory Burd 2013-04-21 11:11:17 -04:00
parent a282ad2f1d
commit fae6831580

View file

@ -296,6 +296,7 @@ async_nif_unload(ErlNifEnv *env, struct async_nif_state *async_nif)
/* Worker threads are stopped, now toss anything left in the queue. */ /* Worker threads are stopped, now toss anything left in the queue. */
struct async_nif_req_entry *req = NULL; struct async_nif_req_entry *req = NULL;
fifo_q_foreach(reqs, q->reqs, req, { fifo_q_foreach(reqs, q->reqs, req, {
enif_clear_env(req->env);
enif_send(NULL, &req->pid, req->env, enif_send(NULL, &req->pid, req->env,
enif_make_tuple2(req->env, enif_make_atom(req->env, "error"), enif_make_tuple2(req->env, enif_make_atom(req->env, "error"),
enif_make_atom(req->env, "shutdown"))); enif_make_atom(req->env, "shutdown")));