boost-coroutine

Differences between Boost.Coroutine and Boost.Coroutine2

筅森魡賤 提交于 2019-12-01 15:00:20
问题 What are the main differences between Boost.Coroutine and Boost.Coroutine2 ? 回答1: Some differences: Boost.Coroutine2 requires C++11 Boost.Coroutine provides symmetric and asymmetric coroutines, Boost.Coroutine2 only provides asymmetric coroutines. 回答2: boost.coroutine2 is the follow-up project of boost.coroutine (boost.coroutine will be marked as deprecated soon) boost.coroutine2 uses class execution_context from boost.context boost.coroutine is implemented with the deprecated C-like fcontext

How to set error_code to asio::yield_context

若如初见. 提交于 2019-11-28 11:44:47
I'd like to create an asynchronous function which takes as it's last argument boost::asio::yield_context. E.g.: int async_meaning_of_life(asio::yield_context yield); I'd also like to be consistent with how Asio returns error codes. That is, if the user does: int result = async_meaning_of_life(yield); and the function fails, then it throws the system_error exception. But if the user does: boost::error_code ec; int result = async_meaning_of_life(yield[ec]); Then - instead of throwing - the error is returned in ec . The problem is that when implementing the function, I can't seem to find a clean

How do stackless coroutines differ from stackful coroutines?

不打扰是莪最后的温柔 提交于 2019-11-27 17:12:33
Background: I'm asking this because I currently have an application with many (hundreds to thousands) of threads. Most of those threads are idle a great portion of the time, waiting on work items to be placed in a queue. When a work item comes available, it is then processed by calling some arbitrarily-complex existing code. On some operating system configurations, the application bumps up against kernel parameters governing the maximum number of user processes, so I'd like to experiment with means to reduce the number of worker threads. My proposed solution: It seems like a coroutine-based

How to set error_code to asio::yield_context

倾然丶 夕夏残阳落幕 提交于 2019-11-27 06:35:10
问题 I'd like to create an asynchronous function which takes as it's last argument boost::asio::yield_context. E.g.: int async_meaning_of_life(asio::yield_context yield); I'd also like to be consistent with how Asio returns error codes. That is, if the user does: int result = async_meaning_of_life(yield); and the function fails, then it throws the system_error exception. But if the user does: boost::error_code ec; int result = async_meaning_of_life(yield[ec]); Then - instead of throwing - the

How do stackless coroutines differ from stackful coroutines?

依然范特西╮ 提交于 2019-11-26 18:53:37
问题 Background: I'm asking this because I currently have an application with many (hundreds to thousands) of threads. Most of those threads are idle a great portion of the time, waiting on work items to be placed in a queue. When a work item comes available, it is then processed by calling some arbitrarily-complex existing code. On some operating system configurations, the application bumps up against kernel parameters governing the maximum number of user processes, so I'd like to experiment with