struct audioc_task {
int fd;
struct btr_node *btrn;
- struct task task;
+ struct task *task;
};
static struct i9e_completer audiod_completers[];
static void audioc_pre_select(struct sched *s, struct task *t)
{
- struct audioc_task *at = container_of(t, struct audioc_task, task);
+ struct audioc_task *at = task_context(t);
int ret = btr_node_status(at->btrn, 0, BTR_NT_ROOT);
if (ret < 0)
static int audioc_post_select(struct sched *s, struct task *t)
{
char *buf = NULL;
- struct audioc_task *at = container_of(t, struct audioc_task, task);
+ struct audioc_task *at = task_context(t);
int ret = btr_node_status(at->btrn, 0, BTR_NT_ROOT);
if (ret < 0)
return ret;
}
-static struct audioc_task audioc_task = {
- .task = {
- .pre_select = audioc_pre_select,
- .post_select = audioc_post_select,
- .status = "audioc task"
- },
-}, *at = &audioc_task;
+static struct audioc_task audioc_task, *at = &audioc_task;
static int audioc_i9e_line_handler(char *line)
{
args = NULL;
at->btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = "audioc line handler"));
- at->task.error = 0;
- register_task(&sched, &at->task);
+ at->task = task_register(&(struct task_info) {
+ .name = "audioc",
+ .pre_select = audioc_pre_select,
+ .post_select = audioc_post_select,
+ .context = at,
+ }, &sched);
i9e_attach_to_stdout(at->btrn);
return 1;
close:
goto out;
para_log = i9e_log;
ret = schedule(&sched);
+ sched_shutdown(&sched);
i9e_close();
para_log = stderr_log;
out: