X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Faio%2Faio_suspend.c;h=1c1060e340a13cedcbd458c98578ec88c483f4e4;hb=8ef9d46f4d0ff4f0073da6bee7ed0cb5f9035ead;hp=2391d786524e75d183771d829945b4678108af41;hpb=4e8a3561652ebcda6a126b3162fc545573889dc4;p=musl diff --git a/src/aio/aio_suspend.c b/src/aio/aio_suspend.c index 2391d786..1c1060e3 100644 --- a/src/aio/aio_suspend.c +++ b/src/aio/aio_suspend.c @@ -2,10 +2,8 @@ #include #include #include "atomic.h" -#include "libc.h" #include "pthread_impl.h" - -extern volatile int __aio_fut; +#include "aio_impl.h" int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec *ts) { @@ -15,6 +13,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,13 +61,19 @@ int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec break; } - ret = __timedwait(pfut, expect, CLOCK_MONOTONIC, ts?&at:0, 0, 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; } } } -LFS64(aio_suspend); +#if !_REDIR_TIME64 +weak_alias(aio_suspend, aio_suspend64); +#endif