convert para_audiod to the new scheduler.
[paraslash.git] / stdin.c
diff --git a/stdin.c b/stdin.c
index 299c326e589ef5e00cc7d8279cacce2db5ef6d33..22f1dd97b2bb6b18d028b890dd6b73eab73fa567 100644 (file)
--- a/stdin.c
+++ b/stdin.c
@@ -14,6 +14,12 @@ void stdin_pre_select(struct sched *s, struct task *t)
        t->ret = 1; /* success */
 }
 
+static void stdin_default_event_handler(struct task *t)
+{
+       PARA_NOTICE_LOG("%p: %s\n", t, PARA_STRERROR(-t->ret));
+       unregister_task(t);
+}
+
 void stdin_post_select(struct sched *s, struct task *t)
 {
        struct stdin_task *sit = t->private_data;
@@ -35,3 +41,16 @@ void stdin_post_select(struct sched *s, struct task *t)
        if (t->ret < 0)
                sit->eof = 1;
 }
+
+void stdin_set_defaults(struct stdin_task *sit)
+{
+       sit->bufsize = 16 * 1024,
+       sit->loaded = 0,
+       sit->eof = 0,
+       sit->task.flags = 0,
+       sit->task.pre_select = stdin_pre_select;
+       sit->task.post_select = stdin_post_select;
+       sit->task.event_handler = stdin_default_event_handler;
+       sit->task.private_data = sit;
+       sprintf(sit->task.status, "stdin reader");
+}