This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question regarding lio_listio


On Mon, Dec 02, 2002 at 07:05:17AM +0530, Bourne wrote:
> Was wondering if we could use lio_listio to enqueue aio requests in a 
> particular order ?
> Ex : if we could process a read only after a write has completed. i.e 
> strictly in that fashion.

The relevant standard
(http://www.opengroup.org/onlinepubs/007904975/functions/lio_listio.html)
says:

  int lio_listio(int mode, struct aiocb *restrict const list[restrict],
                 int nent, struct sigevent *restrict sig);

  The I/O requests enumerated by list are submitted in an unspecified
  order.

With respect to your example, it looks like you don't actually want aio,
since you want the read to wait until the write completes.  You can get
the effect it appears you want (though it seems pointless to use aio) as
follows:

    aio_read (&cb);

    while (aio_error (&(cb)) == EINPROGRESS)
      usleep (10);

    aio_write (&cb);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]