vTaskDelete() while select()
vTaskDelete() while select()
Is it ok to delete a task (vTaskDelete) that is blocked in a select() call ?
Re: vTaskDelete() while select()
I don't think so. In general, it's good practice to only use vTaskDelete to make a task stop itself. If you delete another task, it may be in a state where it took some resource (for instance, malloc()'ed a temporary variable somewhere) and deleting the task will leak that resource.
-
MicroController
- Posts: 2705
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: vTaskDelete() while select()
Unfortunately, FreeRTOS doesn't provide any clean/safe/defined way to interrupt a blocking function like select().
There's xTaskAbortDelay(), which would be up to the task, but it's implemented with an inherent race condition, so not safe/reliable.
The HTTPD component works around the issue by using an additional (local) socket just to be able to get another task out of blocking in a select().
There's xTaskAbortDelay(), which would be up to the task, but it's implemented with an inherent race condition, so not safe/reliable.
The HTTPD component works around the issue by using an additional (local) socket just to be able to get another task out of blocking in a select().
Who is online
Users browsing this forum: ChatGPT-User and 2 guests
