]> git.tue.mpg.de Git - paraslash.git/commitdiff
task_register() conversion: client supervisor task
authorAndre Noll <maan@systemlinux.org>
Mon, 30 Dec 2013 23:45:55 +0000 (23:45 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 May 2014 13:39:00 +0000 (15:39 +0200)
client.c

index d951692caa22f11340dcae3e29962aec2e5aa0ec..d3ad23a4267d18d18ff3490d9d25b88cc6b5a945 100644 (file)
--- a/client.c
+++ b/client.c
@@ -530,13 +530,12 @@ __noreturn static void print_completions(void)
 
 struct supervisor_task {
        bool stdout_task_started;
-       struct task task;
+       struct task *task;
 };
 
 static int supervisor_post_select(struct sched *s, struct task *t)
 {
-       struct supervisor_task *svt = container_of(t, struct supervisor_task,
-               task);
+       struct supervisor_task *svt = task_context(t);
 
        if (ct->task.error < 0)
                return ct->task.error;
@@ -552,12 +551,7 @@ static int supervisor_post_select(struct sched *s, struct task *t)
        return 0;
 }
 
-static struct supervisor_task supervisor_task = {
-       .task = {
-               .post_select = supervisor_post_select,
-               .status = "supervisor task"
-       }
-};
+static struct supervisor_task supervisor_task;
 
 /**
  * The client program to connect to para_server.
@@ -605,7 +599,12 @@ int main(int argc, char *argv[])
                goto out;
        sot.btrn = btr_new_node(&(struct btr_node_description)
                EMBRACE(.name = "stdout", .parent = ct->btrn[0]));
-       register_task(&sched, &supervisor_task.task);
+       supervisor_task.task = task_register(&(struct task_info) {
+               .name = "supervisor",
+               .post_select = supervisor_post_select,
+               .context = &supervisor_task,
+       }, &sched);
+
        ret = schedule(&sched);
        if (ret >= 0 && ct->task.error < 0) {
                switch(ct->task.error) {