Boost ASIO Stream-Oriented posix::stream_descriptor blocking?

Viewed 25

The Boost ASIO documentation says

These classes also provide limited support for regular files. This support assumes that the underlying read and write operations provided by the operating system never fail with EAGAIN or EWOULDBLOCK. (This assumption normally holds for buffered file I/O.) Synchronous and asynchronous read and write operations on file descriptors will succeed but the I/O will always be performed immediately.

Does this mean that "asynchronous" writes actually happen synchronously? Is there a difference in terms of operations finishing between synchronous and asynchronous stream writes then? May it block the program that calls that async_write function (the "asynchronous agent")?

Normally I think of "buffered file I/O" as meaning the std::FILE fwrite / fread function family.. what exactly is meant by that term here? I suppose they mean files that are buffered by the kernel by a buffer cache before being forwarded to the actual device. As opposed to files with the O_DIRECT|O_SYNC flags (??).


In my case, the file is actually a virtual file whose I/O is directed to a kernel module (FunctionFS)... which begs the question: How does the buffering work here? Will write always succeed without error to make Boost ASIO happy?

0 Answers
Related