本文介绍了请告诉我处理Boost.Asio的和文件I / O?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,Boost.Asio的有很多涉及到插座,串行端口,以及各种非文件示例的例子。谷歌还没有真正打开了很多关于我提到,如果ASIO是做异步文件好还是有效的方法I / O。

我有采空区的数据,我想写入到磁盘异步。这可以用在Windows(我的平台)原生重叠IO来完成,但我preFER有一个独立于平台的解决方案。

我很好奇,如果


  1. Boost.Asio的具有任何类型的文件支持

  2. Boost.Asio的文件支持成熟的足够日常文件I / O

  3. 将文件支持不断被添加?什么前景呢?


解决方案

的Boost.Asio的任何类型的文件支持?

与(我认为)升压1.36(其中包含短耳1.2.0),可以使用启动[的boost :: ASIO ::]窗口​​:: stream_handle或窗户:: random_access_handle包裹手柄和执行异步读取和写入方法它在内部使用重叠的结构。

用户拉津还提到的boost :: ASIO ::窗户:: random_access_handle可用于异步操作(例如命名管道,而且文件)。

是Boost.Asio的文件支持成熟,足够日常文件I / O?

由于Boost.Asio的本身就是广泛使用的现在,以及实现使用重叠的IO在内部,我会说是的。

将文件支持不断被添加?什么前景呢?

由于没有在的网站上找到的路线图,我会说,不会再有新增加的Boost.Asio的这个特征。尽管总是有贡献者加入code和类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

  1. boost.asio has any kind of file support
  2. boost.asio file support is mature enough for everyday file i/o
  3. 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 12:28