Skip to content
Snippets Groups Projects
Commit 67030f90 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Add test for aio_cancel() and fix some bugs found by the test

parent 002e6869
No related branches found
No related tags found
No related merge requests found
......@@ -160,11 +160,19 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
*/
status = work_cancel(LPWORK, &aioc->aioc_work);
if (status >= 0)
{
aiocbp->aio_result = -ECANCELED;
ret = AIO_CANCELED;
}
else
{
ret = AIO_NOTCANCELED;
}
/* Remove the container from the list of pending transfers */
(void)aioc_decant(aioc);
ret = status >= 0 ? AIO_CANCELED : AIO_NOTCANCELED;
}
}
}
......@@ -201,14 +209,21 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp)
/* Remove the container from the list of pending transfers */
next = (FAR struct aio_container_s *)aioc->aioc_link.flink;
(void)aioc_decant(aioc);
/* Keep track of the return status */
next = (FAR struct aio_container_s *)aioc->aioc_link.flink;
aiocbp = aioc_decant(aioc);
DEBUGASSERT(aiocbp);
if (ret != AIO_NOTCANCELED)
if (status >= 0)
{
aiocbp->aio_result = -ECANCELED;
if (ret != AIO_NOTCANCELED)
{
ret = AIO_CANCELED;
}
}
else
{
ret = status >= 0 ? AIO_CANCELED : AIO_NOTCANCELED;
ret = AIO_NOTCANCELED;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment