[Haskell-cafe] carry "state" around ....
Richard A. O'Keefe
ok at cs.otago.ac.nz
Sun Jul 20 21:05:48 EDT 2008
I think it may be time for a little clarity about aoicb's.
From the Single Unix Specification:
"The <aio.h> header shall define the aiocb structure
which shall include AT LEAST the following members:
int aio_fildes File descriptor.
off_t aio_offset File offset.
volatile void *aio_buf Location of buffer.
size_t aio_nbytes Length of transfer.
int aio_reqprio Request priority offset. struct
sigevent aio_sigevent Signal number and value.
int aio_lio_opcode Operation to be performed.
The "AT LEAST" here means that
- a portable program may rely on these members being present
- a portable program MUST assume that an unknown number of
additional members are also present
- a portable program may freely copy such a record, but may
only pass it to a library function if that function is
expecting to initialise it
For asynchronous I/O, this means that
- you can allocate an aiocb object
- an aiocb passed to aio_suspend, aio_error,
aio_return, or aio_cancel should have been
filled in by aio_read or aio_write and should
be EXACTLY THE SAME object, not a copy of it.
More information about the Haskell-Cafe