- size_t min_written = 0, max_written = 0;
-
- FOR_EACH_WRITER_NODE(i, g) {
- struct writer_node *wn = &g->writer_nodes[i];
- struct writer *w = writers + wn->writer_num;
- t->error = w->post_select(s, wn);
- if (t->error < 0)
- return;
- if (!i)
- min_written = wn->written;
- else
- min_written = PARA_MIN(min_written, wn->written);
- max_written = PARA_MAX(max_written, wn->written);
- }
- g->last_written = max_written;
- //PARA_INFO_LOG("loaded: %zd, min_written: %zd bytes\n", *g->loaded, min_written);
- if (min_written) {
- *g->loaded -= min_written;
- FOR_EACH_WRITER_NODE(i, g)
- g->writer_nodes[i].written -= min_written;
- }
- if (!*g->loaded && *g->input_error) {
- t->error = *g->input_error;
- return;
- }
- if (*g->loaded && min_written) {
-// PARA_INFO_LOG("moving %zd bytes\n", *g->loaded);
- memmove(*g->bufp, *g->bufp + min_written, *g->loaded);
- }
-}
-
-/**
- * call the open function of each writer in the group
- *
- * \param g the writer node group
- *
- * \return If at least one open function returned an error, all successful
- * writer notes get closed and this error value is returned. Upon success, a
- * task associated with \a g is registered to the scheduler and the function
- * returns a positive value.
- * */
-int wng_open(struct writer_node_group *g)
-{
- int i, ret = 1;