projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fc317d
)
make aio_suspend a cancellation point and properly handle cancellation
author
Rich Felker
<dalias@aerifal.cx>
Mon, 2 Mar 2015 23:11:28 +0000
(18:11 -0500)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 2 Mar 2015 23:13:07 +0000
(18:13 -0500)
src/aio/aio_suspend.c
patch
|
blob
|
history
diff --git
a/src/aio/aio_suspend.c
b/src/aio/aio_suspend.c
index dfa524bfaa922d2a61ecef3a27700afc775b50af..08fb5ddcf1a7b1450fb7446d9e8be202eaa1f42a 100644
(file)
--- a/
src/aio/aio_suspend.c
+++ b/
src/aio/aio_suspend.c
@@
-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;
}
}