diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-06 15:43:28 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-06 15:43:28 +0000 |
commit | f7b7532a4114b831f5ef66ed992d28e65fb3973f (patch) | |
tree | 929ad375fc60be5b08f35b49ff681db96d97b842 /nuttx/sched/task_restart.c | |
parent | d8a1b61690862777b137ec182a0d62dcf4ee8db2 (diff) | |
download | px4-nuttx-f7b7532a4114b831f5ef66ed992d28e65fb3973f.tar.gz px4-nuttx-f7b7532a4114b831f5ef66ed992d28e65fb3973f.tar.bz2 px4-nuttx-f7b7532a4114b831f5ef66ed992d28e65fb3973f.zip |
Changed needed to fix issues with task_restart()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5615 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/task_restart.c')
-rw-r--r-- | nuttx/sched/task_restart.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/nuttx/sched/task_restart.c b/nuttx/sched/task_restart.c index 578585c8e..5f3d80156 100644 --- a/nuttx/sched/task_restart.c +++ b/nuttx/sched/task_restart.c @@ -46,6 +46,7 @@ #include <nuttx/arch.h> #include "os_internal.h" +#include "group_internal.h" #include "sig_internal.h" /**************************************************************************** @@ -143,6 +144,16 @@ int task_restart(pid_t pid) return ERROR; } + /* Try to recover from any bad states */ + + task_recover((FAR struct tcb_s *)tcb); + + /* Kill any children of this thread */ + +#if HAVE_GROUP_MEMBERS + (void)group_killchildren(tcb); +#endif + /* Remove the TCB from whatever list it is in. At this point, the * TCB should no longer be accessible to the system */ @@ -186,8 +197,8 @@ int task_restart(pid_t pid) status = task_activate((FAR struct tcb_s *)tcb); if (status != OK) { - dq_rem((FAR dq_entry_t*)tcb, (dq_queue_t*)&g_inactivetasks); - sched_releasetcb((FAR struct tcb_s *)tcb); + (void)task_delete(pid); + set_errno(-status); return ERROR; } } |