The bug in the wav filter which was fixed in the previous patch
could cause para_filter to hang because the stdin task would not
care whether the filter task has terminated.
Fix it by introducing an output_error pointer.
ret = init_filter_chain();
if (ret < 0)
goto out;
ret = init_filter_chain();
if (ret < 0)
goto out;
+ sit->output_error = &fc->task.error;
stdout_set_defaults(sot);
sot->buf = fc->outbuf;
stdout_set_defaults(sot);
sot->buf = fc->outbuf;
static void stdin_pre_select(struct sched *s, struct task *t)
{
struct stdin_task *sit = container_of(t, struct stdin_task, task);
static void stdin_pre_select(struct sched *s, struct task *t)
{
struct stdin_task *sit = container_of(t, struct stdin_task, task);
+
+ if (sit->output_error && *sit->output_error < 0) {
+ t->error = *sit->output_error;
+ return;
+ }
t->error = 0;
sit->check_fd = 0;
if (sit->loaded >= sit->bufsize)
t->error = 0;
sit->check_fd = 0;
if (sit->loaded >= sit->bufsize)
struct stdin_task *sit = container_of(t, struct stdin_task, task);
ssize_t ret;
struct stdin_task *sit = container_of(t, struct stdin_task, task);
ssize_t ret;
+ if (sit->output_error && *sit->output_error < 0) {
+ t->error = *sit->output_error;
+ return;
+ }
t->error = 0;
if (!sit->check_fd)
return;
t->error = 0;
if (!sit->check_fd)
return;
ret = mark_fd_nonblocking(STDIN_FILENO);
if (ret >= 0)
return;
ret = mark_fd_nonblocking(STDIN_FILENO);
if (ret >= 0)
return;
+ sit->output_error = NULL;
PARA_EMERG_LOG("%s\n", para_strerror(-ret));
exit(EXIT_FAILURE);
}
PARA_EMERG_LOG("%s\n", para_strerror(-ret));
exit(EXIT_FAILURE);
}
size_t bufsize;
/** Number of bytes currently loaded in \a buf. */
size_t loaded;
size_t bufsize;
/** Number of bytes currently loaded in \a buf. */
size_t loaded;
+ /** Pointer to the error member of the consumer. */
+ int *output_error;
/** Whether \p STDIN_FILENO was included in the read fd set. */
int check_fd;
/** The task structure. */
/** Whether \p STDIN_FILENO was included in the read fd set. */
int check_fd;
/** The task structure. */