Date: Sat, 13 Jan 2024 15:18:41 -0700 From: Alan Somers <asomers@freebsd.org> To: freebsd-threads@freebsd.org, Konstantin Belousov <kib@freebsd.org>, =?UTF-8?Q?Vin=C3=ADcius=5Fdos=5FSantos=5FOliveira?= <vini.ipsmaker@gmail.com> Subject: aio_read2() and aio_write2() Message-ID: <CAOtMX2haq%2BErvqD2PDYKUGRgdCrk2SDjtoPL-W5jR8q8_4denA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
I'm not on this mailing list, but I saw kib's code review and I have some comments > Can we have some aio_read() function that ignores aio_offset (i.e. the current file position is used)? I'm trying to port libboost's ASIO file support to FreeBSD, and I stumbled upon this limitation. The fundamental problem with using the file's seek offset with AIO is that multiple operations may be in-flight at any one time that depend on the seek offset, and there's nothing that enforces their ordering. Whether you use aio_read2 as you suggested, or lio_listio as kib suggested, as soon as you submit a second operation before the first one completes the results become undefined. That's why no existing AIO operations involve the seek pointer in any way. How does boost.asio address this problem? Are its operations completed in a strict sequence? -Alan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2haq%2BErvqD2PDYKUGRgdCrk2SDjtoPL-W5jR8q8_4denA>