#include <errno.h>
#include <time.h>
#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)
{
int i, tid = 0, ret, expect = 0;
struct timespec at;
- volatile int dummy_fut, *pfut;
+ volatile int dummy_fut = 0, *pfut;
int nzcnt = 0;
const struct aiocb *cb = 0;
+ pthread_testcancel();
+
if (cnt<0) {
errno = EINVAL;
return -1;
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;
}
}
}
-
-LFS64(aio_suspend);