提交 5451d957 编写于 作者: R Rich Felker

make aio_suspend a cancellation point and properly handle cancellation

上级 0fc317d8
......@@ -15,6 +15,8 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec
int nzcnt = 0;
const struct aiocb *cb = 0;
pthread_testcancel();
if (cnt<0) {
errno = EINVAL;
return -1;
......@@ -61,10 +63,14 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec
break;
}
ret = __timedwait(pfut, expect, CLOCK_MONOTONIC, ts?&at:0, 1);
ret = __timedwait_cp(pfut, expect, CLOCK_MONOTONIC, ts?&at:0, 1);
if (ret) {
errno = ret==ETIMEDOUT ? EAGAIN : ret;
switch (ret) {
case ETIMEDOUT:
ret = EAGAIN;
case ECANCELED:
case EINTR:
errno = ret;
return -1;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册