X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=write_common.c;h=3bf5d1199f560e9ce93b7d97a06e278ce495591f;hp=f9560d7f1ee1050439f16459a6fda786647d9250;hb=6c5220a23d66668e88929b2ba0f66758ab90a7be;hpb=335730538150250f32c0df0b184fb494e2bb0df3 diff --git a/write_common.c b/write_common.c index f9560d7f..3bf5d119 100644 --- a/write_common.c +++ b/write_common.c @@ -79,7 +79,6 @@ int wng_open(struct writer_node_group *g) 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; @@ -90,10 +89,11 @@ int wng_open(struct writer_node_group *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); @@ -102,17 +102,6 @@ err_out: 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 * @@ -124,7 +113,7 @@ void wng_close(struct writer_node_group *g) { 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) {