diff --git a/include/nuttx/wqueue.h b/include/nuttx/wqueue.h index 58162ab88f..a38125446a 100644 --- a/include/nuttx/wqueue.h +++ b/include/nuttx/wqueue.h @@ -470,8 +470,10 @@ int work_cancel_wq(FAR struct kwork_wqueue_s *wqueue, * work - The previously queued work structure to cancel * * Returned Value: - * Zero (OK) on success, a negated errno on failure. This error may be - * reported: + * Zero means the work was successfully cancelled. + * One means the work was not cancelled because it is currently being + * processed by work thread, but wait for it to finish. + * A negated errno value is returned on any failure: * * -ENOENT - There is no such work queued. * -EINVAL - An invalid work queue was specified diff --git a/sched/wqueue/kwork_cancel.c b/sched/wqueue/kwork_cancel.c index 0a91b3dba5..12186b33b1 100644 --- a/sched/wqueue/kwork_cancel.c +++ b/sched/wqueue/kwork_cancel.c @@ -42,29 +42,6 @@ * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: work_qcancel - * - * Description: - * Cancel previously queued work. This removes work from the work queue. - * After work has been cancelled, it may be requeued by calling - * work_queue() again. - * - * Input Parameters: - * wqueue - The work queue to use - * sync - true: synchronous cancel - * false: asynchronous cancel - * work - The previously queued work structure to cancel - * - * Returned Value: - * Zero (OK) on success, a negated errno on failure. This error may be - * reported: - * - * -ENOENT - There is no such work queued. - * -EINVAL - An invalid work queue was specified - * - ****************************************************************************/ - static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, bool sync, FAR struct work_s *work) { @@ -110,7 +87,7 @@ static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, bool sync, wqueue->worker[wndx].pid != nxsched_gettid()) { nxsem_wait_uninterruptible(&wqueue->worker[wndx].wait); - ret = OK; + ret = 1; break; } } @@ -170,8 +147,10 @@ int work_cancel_wq(FAR struct kwork_wqueue_s *wqueue, * work - The previously queued work structure to cancel * * Returned Value: - * Zero (OK) on success, a negated errno on failure. This error may be - * reported: + * Zero means the work was successfully cancelled. + * One means the work was not cancelled because it is currently being + * processed by work thread, but wait for it to finish. + * A negated errno value is returned on any failure: * * -ENOENT - There is no such work queued. * -EINVAL - An invalid work queue was specified