6 #include "pthread_impl.h"
8 extern volatile int __aio_fut;
10 int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec *ts)
12 int i, tid = 0, ret, expect = 0;
14 volatile int dummy_fut, *pfut;
16 const struct aiocb *cb = 0;
25 for (i=0; i<cnt; i++) if (cbs[i]) {
26 if (aio_error(cbs[i]) != EINPROGRESS) return 0;
32 clock_gettime(CLOCK_MONOTONIC, &at);
33 at.tv_sec += ts->tv_sec;
34 if ((at.tv_nsec += ts->tv_nsec) >= 1000000000) {
35 at.tv_nsec -= 1000000000;
42 if (cbs[i] && aio_error(cbs[i]) != EINPROGRESS)
50 pfut = (void *)&cb->__err;
51 expect = EINPROGRESS | 0x80000000;
52 a_cas(pfut, EINPROGRESS, expect);
56 if (!tid) tid = __pthread_self()->tid;
57 expect = a_cas(pfut, 0, tid);
58 if (!expect) expect = tid;
59 /* Need to recheck the predicate before waiting. */
61 if (cbs[i] && aio_error(cbs[i]) != EINPROGRESS)
66 ret = __timedwait_cp(pfut, expect, CLOCK_MONOTONIC, ts?&at:0, 1);