summaryrefslogtreecommitdiff
path: root/nuttx/sched/group_leave.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-06 15:43:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-06 15:43:28 +0000
commitf7b7532a4114b831f5ef66ed992d28e65fb3973f (patch)
tree929ad375fc60be5b08f35b49ff681db96d97b842 /nuttx/sched/group_leave.c
parentd8a1b61690862777b137ec182a0d62dcf4ee8db2 (diff)
downloadpx4-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/group_leave.c')
-rw-r--r--nuttx/sched/group_leave.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/nuttx/sched/group_leave.c b/nuttx/sched/group_leave.c
index b3d2f20f8..490a66ec0 100644
--- a/nuttx/sched/group_leave.c
+++ b/nuttx/sched/group_leave.c
@@ -260,31 +260,18 @@ static inline int group_removemember(FAR struct task_group_s *group, pid_t pid)
if (group->tg_members[i] == pid)
{
- /* Yes.. break out of the loop. We don't do the actual
- * removal here, instead we re-test i and do the adjustments
- * outside of the loop. We do this because we want the
- * DEBUGASSERT to work properly.
+ /* Remove the member from the array of members. This must be an
+ * atomic operation because the member array may be accessed from
+ * interrupt handlers (read-only).
*/
- break;
- }
- }
-
- /* Now, test if we found the task in the array of members. */
-
- if (i < group->tg_nmembers)
- {
- /* Remove the member from the array of members. This must be an
- * atomic operation because the member array may be accessed from
- * interrupt handlers (read-only).
- */
-
- flags = irqsave();
- group->tg_members[i] = group->tg_members[group->tg_nmembers - 1];
- group->tg_nmembers--;
- irqrestore(flags);
+ flags = irqsave();
+ group->tg_members[i] = group->tg_members[group->tg_nmembers - 1];
+ group->tg_nmembers--;
+ irqrestore(flags);
- return group->tg_nmembers;
+ return group->tg_nmembers;
+ }
}
return -ENOENT;