Hi Mark, there's just one problem left:
On Jul 20 01:44, Mark Geisert wrote: > This is the core of the AIO implementation: aio.cc and aio.h. The > latter is used within the Cygwin DLL by aio.cc and the fhandler* modules, > as well as by user programs wanting the AIO functionality. > --- > winsup/cygwin/aio.cc | 1006 +++++++++++++++++++++++++++++++++++ > winsup/cygwin/include/aio.h | 82 +++ > 2 files changed, 1088 insertions(+) > create mode 100644 winsup/cygwin/aio.cc > create mode 100644 winsup/cygwin/include/aio.h > > diff --git a/winsup/cygwin/aio.cc b/winsup/cygwin/aio.cc > new file mode 100644 > index 000000000..0244edf60 > --- /dev/null > +++ b/winsup/cygwin/aio.cc > [...] > +static int > +aiosuspend (const struct aiocb *const aiolist[], > + int nent, const struct timespec *timeout) > +{ > + /* Returns lowest list index of completed aios, else 'nent' if all > completed. > + * If none completed on entry, wait for interval specified by 'timeout'. > + */ > + int res; > + sigset_t sigmask; > + siginfo_t si; > + ULONGLONG ticks = 0; > + ULONGLONG time0, time1; > + struct timespec to = {0}; > + > + if (timeout) > + { > + to = *timeout; > + if (to.tv_sec < 0 || to.tv_nsec < 0 || to.tv_nsec > NSPERSEC) > + { > + set_errno (EINVAL); > + return -1; > + } > + ticks = (NS100PERSEC * to.tv_sec) + > + ((to.tv_nsec + (NSPERSEC/NS100PERSEC) - 1) / > + (NSPERSEC/NS100PERSEC)); > + } > + > +retry: > + sigemptyset (&sigmask); > + int aiocount = 0; > + for (int i = 0; i < nent; ++i) > + if (aiolist[i] && aiolist[i]->aio_liocb) > + { > + if (aiolist[i]->aio_errno == EINPROGRESS || > + aiolist[i]->aio_errno == ENOBUFS || > + aiolist[i]->aio_errno == EBUSY) > + { > + ++aiocount; > + if (aiolist[i]->aio_sigevent.sigev_notify == SIGEV_SIGNAL || > + aiolist[i]->aio_sigevent.sigev_notify == SIGEV_THREAD) > + sigaddset (&sigmask, aiolist[i]->aio_sigevent.sigev_signo); > + } > + else > + return i; > + } > + > + if (aiocount == 0) > + return nent; > + > + if (timeout && ticks == 0) > + { > + set_errno (EAGAIN); > + return -1; > + } > + > + QueryUnbiasedInterruptTime (&time0); Nice idea to use QueryUnbiasedInterruptTime. The problem here is just that QueryUnbiasedInterruptTime has been introduced with Windows 7, but we still support Windows Vista :} We could just drop Vista support (is anybody actually using it?) but there's an alternative: Include hires.h and use ntod, a global ns counter object using Windows performance counters under the hood: #include "hires.h" time0 = ntod.nsecs (); /* ns, *not* 100ns */ ... With that single change I think your patch series can go in. Thanks, Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature