vTaskEndScheduler
[RTOS 内核控制]
task. h void vTaskEndScheduler( void );
注意: 这仅适用于 x86 Real Mode PC 移植。
停止 RTOS 内核滴答。所有已创建的任务将自动删除,多任务处理(抢占式或协作式)将停止。然后从调用 vTaskStartScheduler() 的位置恢复执行,就像 vTaskStartScheduler() 刚刚返回一样。
有关使用 vTaskEndScheduler() 的示例,请参阅 demo/PC 目录中的演示应用程序文件 main.c。
vTaskEndScheduler() 需要在可移植层中定义一个退出函数(有关 PC 移植,请参阅 port.c 中的 vPortEndScheduler())。这将执行硬件特定的操作,例如停止 RTOS 内核滴答。
vTaskEndScheduler() 将释放 RTOS 内核分配的所有资源,但不会释放应用程序任务分配的资源。
示例用法:
void vTaskCode( void * pvParameters )
{
for( ;; )
{
// Task code goes here.
// At some point we want to end the real time kernel processing
// so call ...
vTaskEndScheduler ();
}
}
void vAFunction( void )
{
// Create at least one task before starting the RTOS kernel.
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
// Start the real time kernel with preemption.
vTaskStartScheduler();
// Will only get here when the vTaskCode () task has called
// vTaskEndScheduler (). When we get here we are back to single task
// execution.
}
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|