- FOR_EACH_WRITER_NODE(i, g) {
- struct writer_node *wn = &g->writer_nodes[i];
- t->ret = wn->writer->pre_select(s, wn);
- if (t->ret < 0) {
- g->eof = 1;
- return;
- }
- }
-}
-
-static void wng_post_select(struct sched *s, struct task *t)
-{
- struct writer_node_group *g = t->private_data;
- int i;
- size_t min_written = 0;
-
- FOR_EACH_WRITER_NODE(i, g) {
- struct writer_node *wn = &g->writer_nodes[i];
- t->ret = wn->writer->post_select(s, wn);
- if (t->ret < 0) {
- g->eof = 1;
- return;
- }
- if (!i)
- min_written = wn->written;
- else
- min_written = PARA_MIN(min_written, wn->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_eof) {
- g->eof = 1;
- t->ret = -E_WNG_EOF;
- return;
- }
- t->ret = 1;
- if (*g->loaded && min_written) {
-// PARA_INFO_LOG("moving %zd bytes\n", *g->loaded);
- memmove(g->buf, g->buf + min_written, *g->loaded);
- }