下载 FreeRTOS
 

出色的 RTOS & 嵌入式软件

内核
最新资讯
简化任何设备的身份验证云连接。
利用 CoAP 设计节能型云连接 IoT 解决方案。
11.0.0 版 FreeRTOS 内核简介:
FreeRTOS 路线图和代码贡献流程。
使用 FreeRTOS 实现 OPC-UA over TSN。

vTaskSuspend
[任务控制]

task. h
void vTaskSuspend( TaskHandle_t xTaskToSuspend );

必须将 INCLUDE_vTaskSuspend 定义为 1 才能使用此函数。有关详细信息,请参阅 RTOS 配置文档。

暂停任意任务。无论任务优先级如何,任务被暂停后将永远无法获取任何微控制器处理时间。

对 vTaskSuspend 的调用不会累积次数,例如:若在同一任务上调用 vTaskSuspend () 两次,将仍然仅需调用一次 vTaskResume (),即可准备完毕暂停的任务。

参数:
xTaskToSuspend 被挂起的任务句柄。传递空句柄将导致调用任务被暂停。
用法示例:
void vAFunction( void ) { TaskHandle_t xHandle;

// Create a task, storing the handle. xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle );

// ...

// Use the handle to suspend the created task. vTaskSuspend( xHandle );

// ...

// The created task will not run during this period, unless // another task calls vTaskResume( xHandle ).

//...

// Suspend ourselves. vTaskSuspend( NULL );

// We cannot get here unless another task calls vTaskResume // with our handle as the parameter. }





Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.