*/
struct status_task {
/** The associated task structure of audiod. */
- struct task task;
+ struct task *task;
/** Client data associated with the stat task. */
struct client_task *ct;
/** Do not restart client command until this time. */
static void status_pre_select(struct sched *s, struct task *t)
{
- struct status_task *st = container_of(t, struct status_task, task);
+ struct status_task *st = task_context(t);
int i, ret, cafn = stat_task->current_audio_format_num;
if (must_start_decoder())
/* restart the client task if necessary */
static int status_post_select(struct sched *s, struct task *t)
{
- struct status_task *st = container_of(t, struct status_task, task);
+ struct status_task *st = task_context(t);
if (audiod_status == AUDIOD_OFF) {
if (!st->ct)
static void init_status_task(struct status_task *st)
{
memset(st, 0, sizeof(struct status_task));
- st->task.pre_select = status_pre_select;
- st->task.post_select = status_post_select;
st->sa_time_diff_sign = 1;
st->clock_diff_count = conf.clock_diff_count_arg;
st->current_audio_format_num = -1;
- sprintf(st->task.status, "stat");
st->btrn = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = "stat"));
+
+ stat_task->task = task_register(&(struct task_info) {
+ .name = "stat",
+ .pre_select = status_pre_select,
+ .post_select = status_post_select,
+ .context = stat_task,
+ }, &sched);
}
static void set_initial_status(void)
.context = sig_task,
}, &sched);
- register_task(&sched, &stat_task->task);
sched.default_timeout.tv_sec = 2;
sched.default_timeout.tv_usec = 999 * 1000;
ret = schedule(&sched);