mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 11:03:35 +08:00
Add on_exit(); Re-order some logic in the task shutdown sequence. Sometimes some complex logic needs to execute when closing file descriptors and this needs to happen early while the task is still healthy
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4354 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -140,6 +140,16 @@ int task_delete(pid_t pid)
|
||||
PANIC(OSERR_BADDELETESTATE);
|
||||
}
|
||||
|
||||
/* Perform common task termination logic (flushing streams, calling
|
||||
* functions registered by at_exit/on_exit, etc.). We need to do
|
||||
* this as early as possible so that higher level clean-up logic
|
||||
* can run in a healthy tasking environment.
|
||||
*
|
||||
* I suppose EXIT_SUCCESS is an appropriate return value???
|
||||
*/
|
||||
|
||||
task_exithook(dtcb, EXIT_SUCCESS);
|
||||
|
||||
/* Remove the task from the OS's tasks lists. */
|
||||
|
||||
saved_state = irqsave();
|
||||
@@ -151,13 +161,6 @@ int task_delete(pid_t pid)
|
||||
|
||||
sched_unlock();
|
||||
|
||||
/* Perform common task termination logic (flushing streams, calling
|
||||
* functions registered by at_exit/on_exit, etc.). I suppose EXIT_SUCCESS
|
||||
* is an appropriate return value???
|
||||
*/
|
||||
|
||||
task_exithook(dtcb, EXIT_SUCCESS);
|
||||
|
||||
/* Deallocate its TCB */
|
||||
|
||||
sched_releasetcb(dtcb);
|
||||
|
||||
Reference in New Issue
Block a user