From 74e29e3e9f53baa879bb2f6d7aaf7448f36686a1 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 30 Dec 2013 23:45:55 +0000 Subject: [PATCH] task_register() conversion: client supervisor task --- client.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/client.c b/client.c index d951692c..d3ad23a4 100644 --- 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) { -- 2.39.5