Skip to content
Closed
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
9 changes: 7 additions & 2 deletions sched/wqueue/kwork_cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, bool sync,
FAR struct work_s *work)
{
irqstate_t flags;
FAR sem_t *sync_wait = NULL;
irqstate_t flags;
int ret = 0;

if (wqueue == NULL || work == NULL)
{
Expand All @@ -71,6 +72,10 @@ static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, bool sync,
work_timer_reset(wqueue);
}
}
else
{
ret = -ENOENT;
Comment thread
xiaoxiang781216 marked this conversation as resolved.

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.

why not return, but to through the remaining code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

early return will change the behavior of this function for sync path. I haven't analyzed the consequences of this, so no early return.

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.

ok, but why return -ENOENT in this case? it's fine to return OK if work isn't queued yet since the final result is that the work doesn't fire anyway.

}

/* Note that cancel_sync can not be called in the interrupt
* context and the idletask context.
Expand Down Expand Up @@ -102,7 +107,7 @@ static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, bool sync,
nxsem_wait_uninterruptible(sync_wait);
}

return 0;
return ret;
}

/****************************************************************************
Expand Down
Loading