Fix a few mistakes from the merge.

This commit is contained in:
Gregory Burd 2013-08-26 13:07:46 -04:00
parent da418b4abf
commit f4a1126fde

View file

@ -66,7 +66,6 @@ struct async_nif_work_queue {
unsigned int depth; unsigned int depth;
struct cds_lfq_queue_rcu req_queue; struct cds_lfq_queue_rcu req_queue;
struct async_nif_work_queue *next; struct async_nif_work_queue *next;
STAILQ_HEAD(reqs, async_nif_req_entry) reqs;
}; };
struct async_nif_worker_entry { struct async_nif_worker_entry {
@ -474,7 +473,7 @@ async_nif_unload(ErlNifEnv *env, struct async_nif_state *async_nif)
enif_send(NULL, &req->pid, req->env, enif_make_tuple2(req->env, ATOM_ERROR, ATOM_SHUTDOWN)); enif_send(NULL, &req->pid, req->env, enif_make_tuple2(req->env, ATOM_ERROR, ATOM_SHUTDOWN));
req->fn_post(req->args); req->fn_post(req->args);
free(req->args); free(req->args);
free_env(req->env); enif_free_env(req->env);
free(req); free(req);
} }
} while(node); } while(node);
@ -482,17 +481,13 @@ async_nif_unload(ErlNifEnv *env, struct async_nif_state *async_nif)
} }
/* Free any req structures sitting unused on the recycle queue. */ /* Free any req structures sitting unused on the recycle queue. */
do { while ((node = cds_lfq_dequeue_rcu(&async_nif->recycled_req_queue)) != NULL) {
node = cds_lfq_dequeue_rcu(&async_nif->recycled_req_queue); struct async_nif_req_entry *req;
if (node) { req = caa_container_of(node, struct async_nif_req_entry, queue_entry);
struct async_nif_req_entry *req; enif_free_env(req->env);
req = caa_container_of(node, struct async_nif_req_entry, queue_entry); free(req->args);
free_env(req->env); free(req);
free(req->args); }
free(req);
req = n;
}
} while(node);
cds_lfq_destroy_rcu(&async_nif->recycled_req_queue); // TODO(gburd): check return val cds_lfq_destroy_rcu(&async_nif->recycled_req_queue); // TODO(gburd): check return val
memset(async_nif, 0, sizeof(struct async_nif_state) + (sizeof(struct async_nif_work_queue) * async_nif->num_queues)); memset(async_nif, 0, sizeof(struct async_nif_state) + (sizeof(struct async_nif_work_queue) * async_nif->num_queues));