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:
patacongo
2012-01-31 23:39:12 +00:00
parent ed4ee27f70
commit 35a1f247c4
13 changed files with 267 additions and 84 deletions
+10 -7
View File
@@ -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);