问题描述
我注意到boost.asio有很多涉及套接字,串口和各种非文件示例的例子。对于我来说,谷歌并没有真正发现,提到如果asio是一个很好或有效的方法来做异步文件I / O。我有gobs的我想要异步写入磁盘的数据。这可以在Windows(我的平台)本地重叠io完成,但我宁愿有一个平台独立的解决方案。
我很好奇,如果
- boost.asio具有任何类型的文件支持
- boost.asio文件支持对于日常文件I / O
- 是否会添加文件支持?这样的前景是什么?
boost.asio有什么样的文件支持? / h2>
从(我认为)Boost 1.36(包含Asio 1.2.0)开始,您可以使用[boost :: asio ::] windows :: stream_handle或windows :: random_access_handle包装HANDLE,并在其上执行异步读写方法,在内部使用OVERLAPPED结构。
用户Lazin也提到了boost :: asio :: windows :: random_access_handle可以用于异步操作(例如命名管道,也可以是文件)。
boost.asio文件是否支持日常文件i / o的足够成熟?
由于Boost.Asio本身已被广泛使用,并且实现在内部使用了重叠的IO,所以我会说是的。
文件支持是否会被添加?这是什么前景呢?
因为在网站,我会说,这个功能将不会有新增加到Boost.Asio。虽然贡献者总是有机会向Boost.Asio添加代码和类。也许你甚至可以自己贡献缺失的部分! : - )
I've noticed that boost.asio has a lot of examples involving sockets, serial ports, and all sorts of non-file examples. Google hasn't really turned up a lot for me that mentions if asio is a good or valid approach for doing asynchronous file i/o.
I've got gobs of data i'd like to write to disk asynchronously. This can be done with native overlapped io in Windows (my platform), but I'd prefer to have a platform independent solution.
I'm curious if
- boost.asio has any kind of file support
- boost.asio file support is mature enough for everyday file i/o
- Will file support ever be added? Whats the outlook for this?
Has boost.asio any kind of file support?
Starting with (I think) Boost 1.36 (which contains Asio 1.2.0) you can use [boost::asio::]windows::stream_handle or windows::random_access_handle to wrap a HANDLE and perform asynchronous read and write methods on it that use the OVERLAPPED structure internally.
User Lazin also mentions boost::asio::windows::random_access_handle that can be used for async operations (e.g. named pipes, but also files).
Is boost.asio file support mature enough for everyday file i/o?
As Boost.Asio in itself is widely used by now, and the implementation uses overlapped IO internally, I would say yes.
Will file support ever be added? Whats the outlook for this?
As there's no roadmap found on the Asio website, I would say that there will be no new additions to Boost.Asio for this feature. Although there's always the chance of contributors adding code and classes to Boost.Asio. Maybe you can even contribute the missing parts yourself! :-)
这篇关于与boost.asio和文件I / O有什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!