mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
wqueue: extend the work_cancel_sync() return value
Return 1 to indicate the work was not cancelled. Because it is currently being processed by work thread, but wait for it to finish. Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -470,8 +470,10 @@ int work_cancel_wq(FAR struct kwork_wqueue_s *wqueue,
|
|||||||
* work - The previously queued work structure to cancel
|
* work - The previously queued work structure to cancel
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success, a negated errno on failure. This error may be
|
* Zero means the work was successfully cancelled.
|
||||||
* reported:
|
* 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.
|
* -ENOENT - There is no such work queued.
|
||||||
* -EINVAL - An invalid work queue was specified
|
* -EINVAL - An invalid work queue was specified
|
||||||
|
|||||||
@@ -42,29 +42,6 @@
|
|||||||
* Private Functions
|
* 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,
|
static int work_qcancel(FAR struct kwork_wqueue_s *wqueue, bool sync,
|
||||||
FAR struct work_s *work)
|
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())
|
wqueue->worker[wndx].pid != nxsched_gettid())
|
||||||
{
|
{
|
||||||
nxsem_wait_uninterruptible(&wqueue->worker[wndx].wait);
|
nxsem_wait_uninterruptible(&wqueue->worker[wndx].wait);
|
||||||
ret = OK;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,8 +147,10 @@ int work_cancel_wq(FAR struct kwork_wqueue_s *wqueue,
|
|||||||
* work - The previously queued work structure to cancel
|
* work - The previously queued work structure to cancel
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero (OK) on success, a negated errno on failure. This error may be
|
* Zero means the work was successfully cancelled.
|
||||||
* reported:
|
* 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.
|
* -ENOENT - There is no such work queued.
|
||||||
* -EINVAL - An invalid work queue was specified
|
* -EINVAL - An invalid work queue was specified
|
||||||
|
|||||||
Reference in New Issue
Block a user