这个接口不存在了?xTaskGetHandle

wsghr2021
Posts: 5
Joined: Wed Jun 02, 2021 9:03 am

这个接口不存在了?xTaskGetHandle

Postby wsghr2021 » Wed Jun 02, 2021 9:09 am

在ESP-IDF编程指南中可以找到此函数定义:

Code: Select all

TaskHandle_txTaskGetHandle(const char *pcNameToQuery)
Note
This function takes a relatively long time to complete and should be used sparingly.

Return
The handle of the task that has the human readable name pcNameToQuery. NULL is returned if no matching name is found. INCLUDE_xTaskGetHandle must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available.
实际代码中找不到这个定义。
我想通过task name来查找是否此任务已经创建,应该怎么办呢?
thx

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: 这个接口不存在了?xTaskGetHandle

Postby ESP_Gargamel » Thu Jun 03, 2021 1:19 am

https://www.esp32.com/viewtopic.php?f=2 ... dle#p76437

你看下这个帖子,默认 INCLUDE_xTaskGetHandle == 0,xTaskGetHandle 没有被开放出来。

wsghr2021
Posts: 5
Joined: Wed Jun 02, 2021 9:03 am

Re: 这个接口不存在了?xTaskGetHandle

Postby wsghr2021 » Thu Jun 03, 2021 2:11 am

ESP_Gargamel wrote:
Thu Jun 03, 2021 1:19 am
https://www.esp32.com/viewtopic.php?f=2 ... dle#p76437

你看下这个帖子,默认 INCLUDE_xTaskGetHandle == 0,xTaskGetHandle 没有被开放出来。
刚刚在代码里面找了下,没有找到这个宏和接口。我是ESP-IDF 4.2版本

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: 这个接口不存在了?xTaskGetHandle

Postby ESP_Gargamel » Thu Jun 03, 2021 2:44 am

恩,4.2 里的 FreeRTOS 没有此接口,那参考 https://www.freertos.org/uxTaskGetSystemState.html 来做类似的功能。

Who is online

Users browsing this forum: Google [Bot] and 115 guests