This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: question regarding lio_listio
- From: Amos Waterland <apw at us dot ibm dot com>
- To: Bourne <bourne at ToughGuy dot net>
- Cc: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Mon, 2 Dec 2002 14:26:32 -0600
- Subject: Re: question regarding lio_listio
- References: <3DEAB8D5.6000305@ToughGuy.net>
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);