Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/nuttx/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
#define GROUP_FLAG_DELETED (1 << 2) /* Bit 2: Group has been deleted but not yet freed */
#define GROUP_FLAG_EXITING (1 << 3) /* Bit 3: Group exit is in progress */
#define GROUP_FLAG_FD_BACKTRACE (1 << 4) /* Bit 4: Enable FD backtrace for the group */
/* Bits 3-7: Available */
/* Bits 5-7: Available */

/* Values for struct child_status_s ch_flags */

Expand Down
9 changes: 6 additions & 3 deletions sched/group/group_leave.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* Release group resources after the last member has left the group.
*
* Input Parameters:
* group - The group to be removed.
* group - The group to be released.
*
* Returned Value:
* None.
Expand Down Expand Up @@ -173,17 +173,20 @@ void group_leave(FAR struct tcb_s *tcb)
group = tcb->group;
if (group)
{
bool release = !(tcb->flags & TCB_FLAG_TTYPE_KERNEL);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include comment here explaining the idea of this new modification


/* Remove the member from group. */

#ifdef HAVE_GROUP_MEMBERS
flags = spin_lock_irqsave(&group->tg_lock);
sq_rem(&tcb->member, &group->tg_members);
release = release && sq_empty(&group->tg_members);
spin_unlock_irqrestore(&group->tg_lock, flags);

/* Have all of the members left the group? */

if (sq_empty(&group->tg_members))
#endif

if (release)
{
/* Yes.. Release all of the resource held by the task group */

Expand Down
Loading