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;
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.
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) {