X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client.c;h=038fc0134e52adcc041fa52c152a321b9818b58e;hp=ec32cd414e31df10dd5c7dbecbdef60c5134a5a2;hb=8aa0f575bcca12ab63ab53141c2144448c457478;hpb=d5738d17b54186db8c9c7f119a03b58382ae9be4 diff --git a/client.c b/client.c index ec32cd41..038fc013 100644 --- a/client.c +++ b/client.c @@ -7,7 +7,6 @@ /** \file client.c the client program used to connect to para_server */ #include -#include #include #include "para.h" @@ -24,11 +23,12 @@ INIT_CLIENT_ERRLISTS; +static struct sched sched; static struct client_task *ct; static struct stdin_task sit; static struct stdout_task sot; -static void supervisor_post_select(__a_unused struct sched *s, struct task *t) +static void supervisor_post_select(struct sched *s, struct task *t) { if (ct->task.error < 0) { t->error = ct->task.error; @@ -36,13 +36,13 @@ static void supervisor_post_select(__a_unused struct sched *s, struct task *t) } if (ct->status == CL_SENDING) { stdin_set_defaults(&sit); - register_task(&sit.task); + register_task(s, &sit.task); t->error = -E_TASK_STARTED; return; } if (ct->status == CL_RECEIVING) { stdout_set_defaults(&sot); - register_task(&sot.task); + register_task(s, &sot.task); t->error = -E_TASK_STARTED; return; } @@ -83,6 +83,7 @@ int main(int argc, char *argv[]) init_random_seed_or_die(); s.default_timeout.tv_sec = 1; s.default_timeout.tv_usec = 0; + /* * We add buffer tree nodes for stdin and stdout even though * only one of them will be needed. This simplifies the code @@ -90,13 +91,13 @@ int main(int argc, char *argv[]) */ sit.btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = "stdin")); - ret = client_open(argc, argv, &ct, &client_loglevel, sit.btrn, NULL); + ret = client_open(argc, argv, &ct, &client_loglevel, sit.btrn, NULL, &sched); if (ret < 0) goto out; sot.btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = "stdout", .parent = ct->btrn)); - register_task(&svt); - ret = schedule(&s); + register_task(&sched, &svt); + ret = schedule(&sched); out: client_close(ct); btr_free_node(sit.btrn);