- struct sched sched = {
- .default_timeout = {
- .tv_sec = conf.timeout_arg / 1000,
- .tv_usec = (conf.timeout_arg % 1000) * 1000,
- },
- };
- struct exec_task exec_task = {
- .task = {
- .status = "exec",
- .pre_select = exec_pre_select,
- .post_select = exec_post_select,
- },
- };
- struct status_task status_task = {
- .task = {
- .status = "status",
- .pre_select = status_pre_select,
- .post_select = status_post_select,
- },
- .fd = -1
- };
- struct input_task input_task = {
- .task = {
- .status = "input",
- .pre_select = input_pre_select,
- .post_select = input_post_select,
- },
- };
- struct signal_task signal_task = {
- .task = {
- .status = "signal",
- .pre_select = signal_pre_select,
- .post_select = signal_post_select,
- },
- };
- signal_task.fd = para_signal_init();
+ int ret;
+ struct exec_task exec_task = {.task = NULL};
+ struct status_task status_task = {.fd = -1};
+ struct input_task input_task = {.task = NULL};
+ struct signal_task *signal_task;
+ struct sched sched = {.default_timeout = {.tv_sec = 1}};
+
+ exec_task.task = task_register(&(struct task_info) {
+ .name = "exec",
+ .pre_select = exec_pre_select,
+ .post_select = exec_post_select,
+ .context = &exec_task,
+ }, &sched);
+
+ status_task.task = task_register(&(struct task_info) {
+ .name = "status",
+ .pre_select = status_pre_select,
+ .post_select = status_post_select,
+ .context = &status_task,
+ }, &sched);
+
+ input_task.task = task_register(&(struct task_info) {
+ .name = "input",
+ .pre_select = input_pre_select,
+ .post_select = input_post_select,
+ .context = &input_task,
+ }, &sched);
+
+ signal_task = signal_init_or_die();