int i, ret = 1;
PARA_NOTICE_LOG("opening wng %p with %d writer(s)\n", g, g->num_writers);
- register_task(&g->task);
FOR_EACH_WRITER_NODE(i, g) {
struct writer_node *wn = &g->writer_nodes[i];
wn->wng = g;
g->max_chunk_bytes = PARA_MAX(g->max_chunk_bytes, ret);
}
sprintf(g->task.status, "%s", "writer node group");
+ register_task(&g->task);
+ g->open = 1;
return 1;
err_out:
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
- unregister_task(&g->task);
while (i > 0) {
struct writer_node *wn = &g->writer_nodes[--i];
wn->writer->close(wn);
return ret;
}
-
-/**
- * unregister a writer node group task
- *
- * \param g the group whose task is to be closed
- */
-void wng_unregister(struct writer_node_group *g)
-{
- unregister_task(&g->task);
-}
-
/**
* call the close function of each writer in the given group
*
{
int i;
- if (!g)
+ if (!g || !g->open)
return;
PARA_NOTICE_LOG("closing wng with %d writer(s)\n", g->num_writers);
FOR_EACH_WRITER_NODE(i, g) {