diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-03-02 18:11:28 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-03-02 18:13:07 -0500 |
commit | 5451d95715e3b4b37a32b54695fd1efa2cf3d9da (patch) | |
tree | c4d1144e09f70b20a41844991aae5ab53975cf55 /src/aio | |
parent | 0fc317d83c1167393bf276a8bfbdd9a4e02e8258 (diff) | |
download | musl-5451d95715e3b4b37a32b54695fd1efa2cf3d9da.tar.gz musl-5451d95715e3b4b37a32b54695fd1efa2cf3d9da.tar.bz2 musl-5451d95715e3b4b37a32b54695fd1efa2cf3d9da.tar.xz musl-5451d95715e3b4b37a32b54695fd1efa2cf3d9da.zip |
make aio_suspend a cancellation point and properly handle cancellation
Diffstat (limited to 'src/aio')
-rw-r--r-- | src/aio/aio_suspend.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/aio/aio_suspend.c b/src/aio/aio_suspend.c index dfa524bf..08fb5ddc 100644 --- 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; } } |