简介非线程异步IO在C ++? [英] Intro to non-threaded async IO for C++?

查看:147
本文介绍了简介非线程异步IO在C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对UI开发者(美国)和C ++开发人员(他们)组成一个桌面应用程序团队工作。 C ++的开发者有责任让我们的一切,我们在UI显示的数据,所以他们做的所有IO,数据库访问,网络电话等。

I work on a desktop app team composed of "UI developers" (us) and "C++ developers" (them). The C++ devs are responsible for getting us all the data that we display in the UI, so they do all the IO, database access, web calls, etc.

最近我们碰到与IO阻塞UI线程一些严重的性能问题。当然,该解决方案的情况是,使在IO异步。但是,C ++开发者坚持这是唯一可能通过生成一个新的线程,这是因为我们知道非常昂贵的。

Recently we've run into some serious performance problems with IO blocking the UI thread. Of course, the solution to this is to make the IO asynchronous. But the C++ devs insist this is only possible by spawning a new thread, which is as we know very expensive.

我从Node.js的等该异步IO不需要涉及线程知道。我知道,Win32和presumably Mac电脑,确实有一个事件循环。但是,我不知道什么样的解决方案是在C ++中的土地做异步非多线程IO prevalent。 (也许这libuv东西underlies节点?)。

I know from Node.js etc. that async IO doesn't need to involve threads. I know that Win32, and presumably Macs, do have an event loop. But, I have no idea what solutions are prevalent in C++ land for doing async non-threaded IO. (Maybe that libuv thing that underlies node?).

任何人都可以点一些流行的库,或者更好的教程文章,所以我们可以引入这个概念对我们的C ++开发者?奖励积分的跨平台(PC和Mac)。更多的加分,如果有一个异步非线程的数据库解决方案,因为我相信我们使用SQLite的是我们的很多问题的根源。

Can anyone point to some popular libraries, or better yet tutorial articles, so we can introduce this concept to our C++ devs? Bonus points for cross-platform (PC and Mac). More bonus points if there is an async non-threaded database solution, since I believe our use of SQLite is the source of many of our problems.

推荐答案

升压异步I / O(ASIO)。他们有一个优秀教程和几个的examples 。它是跨平台的。

Boost Asynchronous I/O (asio). They have an excellent tutorial and several examples. It is cross platform.

这篇关于简介非线程异步IO在C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆