总结任务的状态以及是怎么样进行转换的
Ready:就绪态,在创建任务后会进入就绪态
Running:运行态,任务正在运行
Blocked:阻塞态,因为等待某一个事件进入了休眠的状态
Suspended:挂起态,将任务挂起后任务还是存在的
osThreadId_t myTask03Handle;
const osThreadAttr_t myTask03_attributes = {
.name = "myTask03",
.stack_size = 128 * 4,
.priority = (osPriority_t) osPriorityNormal1,
};
void StartTask03(void *argument);
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN StartDefaultTask */
/* Infinite loop */
for(;;)
{
printf("StartDefaultTask is start\r\n");
if(myTask03Handle == NULL)
{
myTask03Handle = osThreadNew(StartTask03, NULL, &myTask03_attributes);
}
printf("11111\r\n");
osDelay(500);
}
/* USER CODE END StartDefaultTask */
}
void StartTask03(void *argument)
{
for(;;)
{
printf("22222\r\n");
osDelay(500);
}
}
for(;;)
{
printf("StartDefaultTask\r\n");
for(i = 0; i < 9000000; i++)
{
;
}
printf("123123\r\n");
osDelay(500);
}