C ++中类似异步/等待功能的推荐选项

I've worked with C# in the past and become somewhat spoiled by ease with which it enables asynchronous programming; in particular, by using Tasks with async and await.

Now I work primarily with C++, and I have enjoyed all of the modern features they've introduced over the last few language updates. With the availability of std::promise, std::future and co_await, C++ seems to be rapidly approaching the convenience that C# offers for asynchronous programming.

似乎有许多库和框架可以“填补” C ++标准留下的空白。它们提供了等待的原语,并实现了线程池,分派器和上下文。我想为下一个项目工作,但是我遇到了一些分析瘫痪的情况。

我正在以易于使用的库的形式针对C ++的异步/等待功能寻求一些建议。我在Windows环境中工作,但是跨平台始终受到欢迎,并且具有前瞻性。

到目前为止我看到的选项:

  • Microsoft PPL - this looks like the closest I've seen to replicating C# Tasks and Continuations. I saw some comments online that suggested this framework is no longer recommended, however, and I've been unable to find any more context than that.
  • WinRT - this seems to be Microsoft's latest and greatest.
  • cppcoro - this is an open-source and cross-platform library which appears to implement similar primitives and concepts to Microsoft's PPL.

在开始新项目时,我正在寻找建议和内部知识,以及如何从这些选项中进行选择。哪些库最能简化异步编程?

评论