Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intro to non-threaded async IO for C++?

Tags:

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.

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.

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?).

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.

like image 747
Domenic Avatar asked Dec 15 '11 15:12

Domenic


1 Answers

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

like image 146
Sam Miller Avatar answered Sep 18 '22 15:09

Sam Miller