📄 main.c
字号:
/* * main.c - an entry point of the sample application * * Copyright (C) YRP Ubiquitous Networking Laboratory, 2005. */#include <basic.h>#include <tk/tkernel.h>#include "sample1.h"/* * main routine */EXPORT INT main(INT ac, UB *av[]){ T_CTSK ctsk; /* information for creating a task */ T_RTSK rtsk; /* task information */ static ID tskid = -1; /* task ID */ if (ac < 0) { /* in case of 'unlspg' command */ if (tskid >= 0) { tet_exit(); /* wait until the child task exited */ while (tk_ref_tsk(tskid, &rtsk) >= E_OK) { tk_dly_tsk(1); } } return 0; } /* creating a task */ ctsk.exinf = NULL; /* extra information */ ctsk.tskatr = TA_HLNG | TA_RNG0; /* task attributes */ ctsk.task = tet_task; /* start address of the task */ ctsk.itskpri = TET_TASK_PRI; /* task priority when starting */ ctsk.stksz = 1024 * 4; /* stack size */ tskid = tk_cre_tsk(&ctsk); /* create a task */ if (tskid < E_OK) { goto EXIT; } /* failed in creating a task */ /* starting the task */ tk_sta_tsk(tskid, tk_get_tid()); /* start a task */ /* sleep until the child wakes up this task */ tk_slp_tsk(TMO_FEVR);EXIT: return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -