- sot->check_fd = 0;
- if (!*sot->loaded) {
- if (*sot->input_error < 0) {
- t->error = *sot->input_error;
- s->timeout.tv_sec = 0;
- s->timeout.tv_usec = 1;
- }
- return;
- }
- sot->check_fd = 1;
- para_fd_set(STDOUT_FILENO, &s->wfds, &s->max_fileno);
-}
-
-static void stdout_pre_select_btr(struct sched *s, struct task *t)
-{
- struct stdout_task *sot = container_of(t, struct stdout_task, task);
- size_t sz = btr_get_input_queue_size(sot->btrn);
-
- t->error = 0;
- sot->check_fd = 0;
- if (sz == 0) {
- if (btr_no_parent(sot->btrn)) {
- t->error = -E_ORPHAN;
- btr_del_node(sot->btrn);
- s->timeout.tv_sec = 0;
- s->timeout.tv_usec = 1;
- }
- return;
- }
- sot->check_fd = 1;
- para_fd_set(STDOUT_FILENO, &s->wfds, &s->max_fileno);
+ ret = btr_node_status(sot->btrn, 0, BTR_NT_LEAF);
+ if (ret > 0)
+ para_fd_set(STDOUT_FILENO, &s->wfds, &s->max_fileno);
+ else if (ret < 0)
+ sched_min_delay(s);