Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best API to combine C++11 async/futures with Windows asynchronous IO?

Especially the upcoming Windows 8 (with Metro) will require that any IO is programmed asynchronously. In C#/.Net there seems to be special await and such like constructs for that and the JavaScript API will have its own mechanism for that to work.

What will be the C++11-integration for that? Is the a concise example (eg. reading an image from a file for display?) for modern (or upcoming) Windows? If it's using C++11 features I would expect that async or future is involved?

like image 464
towi Avatar asked Oct 03 '11 14:10

towi


2 Answers

The Tips and tricks for developing Metro style apps using C++ presentation covers this at 59:13. The raw interface uses callback objects. In practice, people are likely to use the simplified interface offered by PPL.

like image 184
Raymond Chen Avatar answered Sep 27 '22 22:09

Raymond Chen


Windows 8 async will probably be done through PPL. You can read more about that here.

From my understanding, Windows 8 and PPL uses task-based scheduling and cooperative blocking. While std::async and std::future use thread based scheduling and preemptive blocking. Thus they are not compatible.

like image 44
ronag Avatar answered Sep 27 '22 22:09

ronag